]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
pycore_pystate.h no longer redefines PyThreadState_GET() (GH-28921)
authorVictor Stinner <vstinner@python.org>
Wed, 13 Oct 2021 12:09:13 +0000 (14:09 +0200)
committerGitHub <noreply@github.com>
Wed, 13 Oct 2021 12:09:13 +0000 (14:09 +0200)
commit7cdc2a0f4b785327ad9d55312409a06e554df3d5
tree71a2b8fdc68c9fbebfc79e0a3dffafbcad72dd4e
parent773330773968f211c77abc7b5b525faa7b3c35a2
pycore_pystate.h no longer redefines PyThreadState_GET() (GH-28921)

Redefining the PyThreadState_GET() macro in pycore_pystate.h is
useless since it doesn't affect files not including it. Either use
_PyThreadState_GET() directly, or don't use pycore_pystate.h internal
C API. For example, the _testcapi extension don't use the internal C
API, but use the public PyThreadState_Get() function instead.

Replace PyThreadState_Get() with _PyThreadState_GET(). The
_PyThreadState_GET() macro is more efficient than PyThreadState_Get()
and PyThreadState_GET() function calls which call fail with a fatal
Python error.

posixmodule.c and _ctypes extension now include <windows.h> before
pycore header files (like pycore_call.h).

_PyTraceback_Add() now uses _PyErr_Fetch()/_PyErr_Restore() instead
of PyErr_Fetch()/PyErr_Restore().

The _decimal and _xxsubinterpreters extensions are now built with the
Py_BUILD_CORE_MODULE macro defined to get access to the internal C
API.
23 files changed:
Include/internal/pycore_call.h
Include/internal/pycore_ceval.h
Include/internal/pycore_pystate.h
Include/pystate.h
Modules/_asynciomodule.c
Modules/_ctypes/_ctypes.c
Modules/_ctypes/callbacks.c
Modules/_ctypes/cfield.c
Modules/_ctypes/stgdict.c
Modules/_decimal/_decimal.c
Modules/_lsprof.c
Modules/_testinternalcapi.c
Modules/_threadmodule.c
Modules/_xxsubinterpretersmodule.c
Modules/posixmodule.c
Objects/typeobject.c
Python/bltinmodule.c
Python/ceval.c
Python/context.c
Python/pylifecycle.c
Python/pystate.c
Python/traceback.c
setup.py