From 50b48572d9a90c5bb36e2bef6179548ea927a35a Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Thu, 1 Nov 2018 01:51:40 +0100 Subject: 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. --- Objects/call.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Objects/call.c') diff --git a/Objects/call.c b/Objects/call.c index 9061d0b1ac..48e3aafe5f 100644 --- a/Objects/call.c +++ b/Objects/call.c @@ -258,7 +258,7 @@ function_code_fastcall(PyCodeObject *co, PyObject *const *args, Py_ssize_t nargs PyObject *globals) { PyFrameObject *f; - PyThreadState *tstate = PyThreadState_GET(); + PyThreadState *tstate = _PyThreadState_GET(); PyObject **fastlocals; Py_ssize_t i; PyObject *result; -- cgit v1.2.1