mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
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.
This commit is contained in:
parent
7733307739
commit
7cdc2a0f4b
23 changed files with 87 additions and 77 deletions
|
@ -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__
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue