mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
bpo-34301: Add _PyInterpreterState_Get() helper function (GH-8592)
sys_setcheckinterval() now uses a local variable to parse arguments, before writing into interp->check_interval.
This commit is contained in:
parent
2ebd3813af
commit
caba55b3b7
22 changed files with 107 additions and 93 deletions
|
@ -26,10 +26,9 @@ _copy_raw_string(PyObject *strobj)
|
|||
static PyInterpreterState *
|
||||
_get_current(void)
|
||||
{
|
||||
PyThreadState *tstate = PyThreadState_Get();
|
||||
// PyThreadState_Get() aborts if lookup fails, so we don't need
|
||||
// _PyInterpreterState_Get() aborts if lookup fails, so don't need
|
||||
// to check the result for NULL.
|
||||
return tstate->interp;
|
||||
return _PyInterpreterState_Get();
|
||||
}
|
||||
|
||||
static int64_t
|
||||
|
@ -1941,7 +1940,7 @@ _run_script_in_interpreter(PyInterpreterState *interp, const char *codestr,
|
|||
|
||||
// Switch to interpreter.
|
||||
PyThreadState *save_tstate = NULL;
|
||||
if (interp != PyThreadState_Get()->interp) {
|
||||
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