diff options
author | Victor Stinner <vstinner@python.org> | 2021-10-13 12:09:13 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-13 12:09:13 (GMT) |
commit | 7cdc2a0f4b785327ad9d55312409a06e554df3d5 (patch) | |
tree | 71a2b8fdc68c9fbebfc79e0a3dffafbcad72dd4e /Modules/posixmodule.c | |
parent | 773330773968f211c77abc7b5b525faa7b3c35a2 (diff) | |
download | cpython-7cdc2a0f4b785327ad9d55312409a06e554df3d5.zip cpython-7cdc2a0f4b785327ad9d55312409a06e554df3d5.tar.gz cpython-7cdc2a0f4b785327ad9d55312409a06e554df3d5.tar.bz2 |
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.
Diffstat (limited to 'Modules/posixmodule.c')
-rw-r--r-- | Modules/posixmodule.c | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c index ada1a58..9c174ee 100644 --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -10,31 +10,25 @@ #define PY_SSIZE_T_CLEAN #include "Python.h" -#include "pycore_call.h" // _PyObject_CallNoArgs() -#include "pycore_fileutils.h" // _Py_closerange() -#include "pycore_moduleobject.h" // _PyModule_GetState() +// Include <windows.h> before pycore internal headers. FSCTL_GET_REPARSE_POINT +// is not exported by <windows.h> if the WIN32_LEAN_AND_MEAN macro is defined, +// whereas pycore_condvar.h defines the WIN32_LEAN_AND_MEAN macro. #ifdef MS_WINDOWS - /* include <windows.h> early to avoid conflict with pycore_condvar.h: - - #define WIN32_LEAN_AND_MEAN - #include <windows.h> - - FSCTL_GET_REPARSE_POINT is not exported with WIN32_LEAN_AND_MEAN. */ # include <windows.h> # include <pathcch.h> #endif -#if !defined(EX_OK) && defined(EXIT_SUCCESS) -#define EX_OK EXIT_SUCCESS -#endif - #ifdef __VXWORKS__ # include "pycore_bitutils.h" // _Py_popcount32() #endif +#include "pycore_call.h" // _PyObject_CallNoArgs() +#include "pycore_fileutils.h" // _Py_closerange() +#include "pycore_moduleobject.h" // _PyModule_GetState() #include "pycore_ceval.h" // _PyEval_ReInitThreads() #include "pycore_import.h" // _PyImport_ReInitLock() #include "pycore_initconfig.h" // _PyStatus_EXCEPTION() #include "pycore_pystate.h" // _PyInterpreterState_GET() + #include "structmember.h" // PyMemberDef #ifndef MS_WINDOWS # include "posixmodule.h" @@ -42,6 +36,10 @@ # include "winreparse.h" #endif +#if !defined(EX_OK) && defined(EXIT_SUCCESS) +# define EX_OK EXIT_SUCCESS +#endif + /* On android API level 21, 'AT_EACCESS' is not declared although * HAVE_FACCESSAT is defined. */ #ifdef __ANDROID__ |