mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
bpo-39465: Use _PyInterpreterState_GET() (GH-20788)
Replace _PyThreadState_GET() with _PyInterpreterState_GET() in: * get_small_int() * gcmodule.c: add also get_gc_state() function * _PyTrash_deposit_object() * _PyTrash_destroy_chain() * warnings_get_state() * Py_GetRecursionLimit() Cleanup listnode.c: add 'parser' variable.
This commit is contained in:
parent
9c24e2e4c1
commit
1bcc32f062
7 changed files with 55 additions and 62 deletions
|
@ -32,14 +32,14 @@ _Py_IDENTIFIER(__name__);
|
|||
static WarningsState *
|
||||
warnings_get_state(void)
|
||||
{
|
||||
PyThreadState *tstate = _PyThreadState_GET();
|
||||
if (tstate == NULL) {
|
||||
_PyErr_SetString(tstate, PyExc_RuntimeError,
|
||||
"warnings_get_state: could not identify "
|
||||
"current interpreter");
|
||||
PyInterpreterState *interp = _PyInterpreterState_GET();
|
||||
if (interp == NULL) {
|
||||
PyErr_SetString(PyExc_RuntimeError,
|
||||
"warnings_get_state: could not identify "
|
||||
"current interpreter");
|
||||
return NULL;
|
||||
}
|
||||
return &tstate->interp->warnings;
|
||||
return &interp->warnings;
|
||||
}
|
||||
|
||||
/* Clear the given warnings module state. */
|
||||
|
|
|
@ -788,8 +788,8 @@ _PyEval_FiniState(struct _ceval_state *ceval)
|
|||
int
|
||||
Py_GetRecursionLimit(void)
|
||||
{
|
||||
PyThreadState *tstate = _PyThreadState_GET();
|
||||
return tstate->interp->ceval.recursion_limit;
|
||||
PyInterpreterState *interp = _PyInterpreterState_GET();
|
||||
return interp->ceval.recursion_limit;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue