File tree Expand file tree Collapse file tree 3 files changed +9
-11
lines changed
Expand file tree Collapse file tree 3 files changed +9
-11
lines changed Original file line number Diff line number Diff line change @@ -14,13 +14,10 @@ extern "C" {
1414// Don't call this function but _PyLong_GetZero() and _PyLong_GetOne()
1515static inline PyObject * __PyLong_GetSmallInt_internal (int value )
1616{
17- PyThreadState * tstate = _PyThreadState_GET ();
18- #ifdef Py_DEBUG
19- _Py_EnsureTstateNotNULL (tstate );
20- #endif
17+ PyInterpreterState * interp = _PyInterpreterState_GET ();
2118 assert (- _PY_NSMALLNEGINTS <= value && value < _PY_NSMALLPOSINTS );
2219 size_t index = _PY_NSMALLNEGINTS + value ;
23- PyObject * obj = (PyObject * )tstate -> interp -> small_ints [index ];
20+ PyObject * obj = (PyObject * )interp -> small_ints [index ];
2421 // _PyLong_GetZero() and _PyLong_GetOne() must not be called
2522 // before _PyLong_Init() nor after _PyLong_Fini()
2623 assert (obj != NULL );
Original file line number Diff line number Diff line change @@ -8,9 +8,9 @@ extern "C" {
88# error "this header requires Py_BUILD_CORE define"
99#endif
1010
11- #include "pycore_gc.h" // _PyObject_GC_IS_TRACKED()
12- #include "pycore_interp.h" // PyInterpreterState.gc
13- #include "pycore_pystate.h" // _PyThreadState_GET ()
11+ #include "pycore_gc.h" // _PyObject_GC_IS_TRACKED()
12+ #include "pycore_interp.h" // PyInterpreterState.gc
13+ #include "pycore_pystate.h" // _PyInterpreterState_GET ()
1414
1515PyAPI_FUNC (int ) _PyType_CheckConsistency (PyTypeObject * type );
1616PyAPI_FUNC (int ) _PyDict_CheckConsistency (PyObject * mp , int check_content );
@@ -85,8 +85,8 @@ static inline void _PyObject_GC_TRACK(
8585 "object is in generation which is garbage collected" ,
8686 filename , lineno , __func__ );
8787
88- PyThreadState * tstate = _PyThreadState_GET ();
89- PyGC_Head * generation0 = tstate -> interp -> gc .generation0 ;
88+ PyInterpreterState * interp = _PyInterpreterState_GET ();
89+ PyGC_Head * generation0 = interp -> gc .generation0 ;
9090 PyGC_Head * last = (PyGC_Head * )(generation0 -> _gc_prev );
9191 _PyGCHead_SET_NEXT (last , gc );
9292 _PyGCHead_SET_PREV (gc , last );
Original file line number Diff line number Diff line change 11#include "Python.h"
22#include "pycore_initconfig.h" // _PyStatus_ERR
33#include "pycore_pyerrors.h" // _Py_DumpExtensionModules
4+ #include "pycore_pystate.h" // _PyThreadState_GET()
45#include "pycore_traceback.h" // _Py_DumpTracebackThreads
56#include <signal.h>
67#include <object.h>
@@ -208,7 +209,7 @@ faulthandler_get_fileno(PyObject **file_ptr)
208209static PyThreadState *
209210get_thread_state (void )
210211{
211- PyThreadState * tstate = _PyThreadState_UncheckedGet ();
212+ PyThreadState * tstate = _PyThreadState_GET ();
212213 if (tstate == NULL ) {
213214 /* just in case but very unlikely... */
214215 PyErr_SetString (PyExc_RuntimeError ,
You can’t perform that action at this time.
0 commit comments