Stable ABI/Limited API for free-threaded builds

Yes, if we rev the API completely, Py_OPAQUE_PYOBJECT will be useless.
But I’m afraid of making these removals block people from using other 3.15 features.

Granted!
Py_OPAQUE_PYOBJECT does nothing but hide APIs that are incompatible between regular and free-threaded builds.
For the record, the preliminary list is:

  • struct _object (making PyObject opaque)
  • struct PyVarObject (making PyVarObject opaque)
  • PyObject_HEAD
  • _PyObject_EXTRA_INIT
  • PyObject_HEAD_INIT
  • PyObject_VAR_HEAD
  • Py_SIZE (can be exported as a function instead)
  • Py_SET_TYPE (can be exported as a function instead)
  • Py_SET_SIZE (can be exported as a function instead)

I think your idea ties in nicely with my forward-compatible slots idea :‍)

If we do not rev the API completely, these can be added at any point.