mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
gh-111506: Add _Py_OPAQUE_PYOBJECT to hide PyObject layout & related API (GH-136505)
Allow Py_LIMITED_API for (Py_GIL_DISABLED && _Py_OPAQUE_PYOBJECT) API that's removed when _Py_OPAQUE_PYOBJECT is defined: - PyObject_HEAD - _PyObject_EXTRA_INIT - PyObject_HEAD_INIT - PyObject_VAR_HEAD - struct _object (i.e. PyObject) (opaque) - struct PyVarObject (opaque) - Py_SIZE - Py_SET_TYPE - Py_SET_SIZE - PyModuleDef_Base (opaque) - PyModuleDef_HEAD_INIT - PyModuleDef (opaque) - _Py_IsImmortal - _Py_IsStaticImmortal Note that the `_Py_IsImmortal` removal (and a few other issues) means _Py_OPAQUE_PYOBJECT only works with limited API 3.14+ now. Co-authored-by: Victor Stinner <vstinner@python.org>
This commit is contained in:
parent
db47f4d844
commit
c7d24b81c3
8 changed files with 123 additions and 25 deletions
|
@ -45,19 +45,19 @@
|
|||
# endif
|
||||
#endif
|
||||
|
||||
// gh-111506: The free-threaded build is not compatible with the limited API
|
||||
// or the stable ABI.
|
||||
#if defined(Py_LIMITED_API) && defined(Py_GIL_DISABLED)
|
||||
# error "The limited API is not currently supported in the free-threaded build"
|
||||
#endif
|
||||
#if defined(Py_GIL_DISABLED)
|
||||
# if defined(Py_LIMITED_API) && !defined(_Py_OPAQUE_PYOBJECT)
|
||||
# error "Py_LIMITED_API is not currently supported in the free-threaded build"
|
||||
# endif
|
||||
|
||||
#if defined(Py_GIL_DISABLED) && defined(_MSC_VER)
|
||||
# include <intrin.h> // __readgsqword()
|
||||
#endif
|
||||
# if defined(_MSC_VER)
|
||||
# include <intrin.h> // __readgsqword()
|
||||
# endif
|
||||
|
||||
#if defined(Py_GIL_DISABLED) && defined(__MINGW32__)
|
||||
# include <intrin.h> // __readgsqword()
|
||||
#endif
|
||||
# if defined(__MINGW32__)
|
||||
# include <intrin.h> // __readgsqword()
|
||||
# endif
|
||||
#endif // Py_GIL_DISABLED
|
||||
|
||||
// Include Python header files
|
||||
#include "pyport.h"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue