mirror of
https://github.com/python/cpython.git
synced 2025-10-16 19:57:59 +00:00
bpo-39947: Add PyInterpreterState_Get() function (GH-18979)
* Rename _PyInterpreterState_Get() to PyInterpreterState_Get() and move it the limited C API. * Add _PyInterpreterState_Get() alias to PyInterpreterState_Get() for backward compatibility with Python 3.8.
This commit is contained in:
parent
ff4584caca
commit
be79373a78
8 changed files with 35 additions and 14 deletions
|
@ -396,7 +396,7 @@ _PyInterpreterState_DeleteExceptMain(_PyRuntimeState *runtime)
|
|||
|
||||
|
||||
PyInterpreterState *
|
||||
_PyInterpreterState_Get(void)
|
||||
PyInterpreterState_Get(void)
|
||||
{
|
||||
PyThreadState *tstate = _PyThreadState_GET();
|
||||
if (tstate == NULL) {
|
||||
|
@ -1423,9 +1423,9 @@ _check_xidata(_PyCrossInterpreterData *data)
|
|||
int
|
||||
_PyObject_GetCrossInterpreterData(PyObject *obj, _PyCrossInterpreterData *data)
|
||||
{
|
||||
// _PyInterpreterState_Get() aborts if lookup fails, so we don't need
|
||||
// PyInterpreterState_Get() aborts if lookup fails, so we don't need
|
||||
// to check the result for NULL.
|
||||
PyInterpreterState *interp = _PyInterpreterState_Get();
|
||||
PyInterpreterState *interp = PyInterpreterState_Get();
|
||||
|
||||
// Reset data before re-populating.
|
||||
*data = (_PyCrossInterpreterData){0};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue