mirror of
https://github.com/python/cpython.git
synced 2025-11-01 18:51:43 +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
|
|
@ -26,9 +26,9 @@ _copy_raw_string(PyObject *strobj)
|
|||
static PyInterpreterState *
|
||||
_get_current(void)
|
||||
{
|
||||
// _PyInterpreterState_Get() aborts if lookup fails, so don't need
|
||||
// PyInterpreterState_Get() aborts if lookup fails, so don't need
|
||||
// to check the result for NULL.
|
||||
return _PyInterpreterState_Get();
|
||||
return PyInterpreterState_Get();
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1928,7 +1928,7 @@ _run_script_in_interpreter(PyInterpreterState *interp, const char *codestr,
|
|||
|
||||
// Switch to interpreter.
|
||||
PyThreadState *save_tstate = NULL;
|
||||
if (interp != _PyInterpreterState_Get()) {
|
||||
if (interp != PyInterpreterState_Get()) {
|
||||
// XXX Using the "head" thread isn't strictly correct.
|
||||
PyThreadState *tstate = PyInterpreterState_ThreadHead(interp);
|
||||
// XXX Possible GILState issues?
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue