diff options
| author | Victor Stinner <vstinner@redhat.com> | 2018-11-01 01:51:40 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-11-01 01:51:40 +0100 |
| commit | 50b48572d9a90c5bb36e2bef6179548ea927a35a (patch) | |
| tree | 3b77efe6c7182a3e0b98fcba9854198dbeca3a98 /Objects/typeobject.c | |
| parent | 27e2d1f21975dfb8c0ddcb192fa0f45a51b7977e (diff) | |
| download | cpython-git-50b48572d9a90c5bb36e2bef6179548ea927a35a.tar.gz | |
bpo-35081: Add _PyThreadState_GET() internal macro (GH-10266)
If Py_BUILD_CORE is defined, the PyThreadState_GET() macro access
_PyRuntime which comes from the internal pycore_state.h header.
Public headers must not require internal headers.
Move PyThreadState_GET() and _PyInterpreterState_GET_UNSAFE() from
Include/pystate.h to Include/internal/pycore_state.h, and rename
PyThreadState_GET() to _PyThreadState_GET() there.
The PyThreadState_GET() macro of pystate.h is now redefined when
pycore_state.h is included, to use the fast _PyThreadState_GET().
Changes:
* Add _PyThreadState_GET() macro
* Replace "PyThreadState_GET()->interp" with
_PyInterpreterState_GET_UNSAFE()
* Replace PyThreadState_GET() with _PyThreadState_GET() in internal C
files (compiled with Py_BUILD_CORE defined), but keep
PyThreadState_GET() in the public header files.
* _testcapimodule.c: replace PyThreadState_GET() with
PyThreadState_Get(); the module is not compiled with Py_BUILD_CORE
defined.
* pycore_state.h now requires Py_BUILD_CORE to be defined.
Diffstat (limited to 'Objects/typeobject.c')
| -rw-r--r-- | Objects/typeobject.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Objects/typeobject.c b/Objects/typeobject.c index 9a390b3e50..dedc4f7c87 100644 --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -1115,7 +1115,7 @@ subtype_dealloc(PyObject *self) { PyTypeObject *type, *base; destructor basedealloc; - PyThreadState *tstate = PyThreadState_GET(); + PyThreadState *tstate = _PyThreadState_GET(); int has_finalizer; /* Extract the type; we expect it to be a heap type */ @@ -7678,7 +7678,7 @@ super_init(PyObject *self, PyObject *args, PyObject *kwds) PyFrameObject *f; PyCodeObject *co; Py_ssize_t i, n; - f = PyThreadState_GET()->frame; + f = _PyThreadState_GET()->frame; if (f == NULL) { PyErr_SetString(PyExc_RuntimeError, "super(): no current frame"); |
