mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +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
|
@ -5,6 +5,7 @@
|
|||
#include "Python.h"
|
||||
#include "frameobject.h"
|
||||
#include "pycore_frame.h"
|
||||
#include "pycore_pystate.h" // _PyThreadState_GET()
|
||||
#include "interpreteridobject.h"
|
||||
|
||||
|
||||
|
@ -2017,7 +2018,7 @@ interp_create(PyObject *self, PyObject *args, PyObject *kwds)
|
|||
}
|
||||
|
||||
// Create and initialize the new interpreter.
|
||||
PyThreadState *save_tstate = PyThreadState_Get();
|
||||
PyThreadState *save_tstate = _PyThreadState_GET();
|
||||
// XXX Possible GILState issues?
|
||||
PyThreadState *tstate = _Py_NewInterpreter(isolated);
|
||||
PyThreadState_Swap(save_tstate);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue