mirror of
https://github.com/python/cpython.git
synced 2025-08-03 08:34:29 +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
|
@ -41,8 +41,8 @@ static PyObject *
|
|||
get_small_int(sdigit ival)
|
||||
{
|
||||
assert(IS_SMALL_INT(ival));
|
||||
PyThreadState *tstate = _PyThreadState_GET();
|
||||
PyObject *v = (PyObject*)tstate->interp->small_ints[ival + NSMALLNEGINTS];
|
||||
PyInterpreterState *interp = _PyInterpreterState_GET();
|
||||
PyObject *v = (PyObject*)interp->small_ints[ival + NSMALLNEGINTS];
|
||||
Py_INCREF(v);
|
||||
return v;
|
||||
}
|
||||
|
|
|
@ -2029,8 +2029,8 @@ finally:
|
|||
void
|
||||
_PyTrash_deposit_object(PyObject *op)
|
||||
{
|
||||
PyThreadState *tstate = _PyThreadState_GET();
|
||||
struct _gc_runtime_state *gcstate = &tstate->interp->gc;
|
||||
PyInterpreterState *interp = _PyInterpreterState_GET();
|
||||
struct _gc_runtime_state *gcstate = &interp->gc;
|
||||
|
||||
_PyObject_ASSERT(op, _PyObject_IS_GC(op));
|
||||
_PyObject_ASSERT(op, !_PyObject_GC_IS_TRACKED(op));
|
||||
|
@ -2057,8 +2057,8 @@ _PyTrash_thread_deposit_object(PyObject *op)
|
|||
void
|
||||
_PyTrash_destroy_chain(void)
|
||||
{
|
||||
PyThreadState *tstate = _PyThreadState_GET();
|
||||
struct _gc_runtime_state *gcstate = &tstate->interp->gc;
|
||||
PyInterpreterState *interp = _PyInterpreterState_GET();
|
||||
struct _gc_runtime_state *gcstate = &interp->gc;
|
||||
|
||||
while (gcstate->trash_delete_later) {
|
||||
PyObject *op = gcstate->trash_delete_later;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue