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" {
14
14
// Don't call this function but _PyLong_GetZero() and _PyLong_GetOne()
15
15
static inline PyObject * __PyLong_GetSmallInt_internal (int value )
16
16
{
17
- PyThreadState * tstate = _PyThreadState_GET ();
18
- #ifdef Py_DEBUG
19
- _Py_EnsureTstateNotNULL (tstate );
20
- #endif
17
+ PyInterpreterState * interp = _PyInterpreterState_GET ();
21
18
assert (- _PY_NSMALLNEGINTS <= value && value < _PY_NSMALLPOSINTS );
22
19
size_t index = _PY_NSMALLNEGINTS + value ;
23
- PyObject * obj = (PyObject * )tstate -> interp -> small_ints [index ];
20
+ PyObject * obj = (PyObject * )interp -> small_ints [index ];
24
21
// _PyLong_GetZero() and _PyLong_GetOne() must not be called
25
22
// before _PyLong_Init() nor after _PyLong_Fini()
26
23
assert (obj != NULL );
Original file line number Diff line number Diff line change @@ -8,9 +8,9 @@ extern "C" {
8
8
# error "this header requires Py_BUILD_CORE define"
9
9
#endif
10
10
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 ()
14
14
15
15
PyAPI_FUNC (int ) _PyType_CheckConsistency (PyTypeObject * type );
16
16
PyAPI_FUNC (int ) _PyDict_CheckConsistency (PyObject * mp , int check_content );
@@ -85,8 +85,8 @@ static inline void _PyObject_GC_TRACK(
85
85
"object is in generation which is garbage collected" ,
86
86
filename , lineno , __func__ );
87
87
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 ;
90
90
PyGC_Head * last = (PyGC_Head * )(generation0 -> _gc_prev );
91
91
_PyGCHead_SET_NEXT (last , gc );
92
92
_PyGCHead_SET_PREV (gc , last );
Original file line number Diff line number Diff line change 1
1
#include "Python.h"
2
2
#include "pycore_initconfig.h" // _PyStatus_ERR
3
3
#include "pycore_pyerrors.h" // _Py_DumpExtensionModules
4
+ #include "pycore_pystate.h" // _PyThreadState_GET()
4
5
#include "pycore_traceback.h" // _Py_DumpTracebackThreads
5
6
#include <signal.h>
6
7
#include <object.h>
@@ -208,7 +209,7 @@ faulthandler_get_fileno(PyObject **file_ptr)
208
209
static PyThreadState *
209
210
get_thread_state (void )
210
211
{
211
- PyThreadState * tstate = _PyThreadState_UncheckedGet ();
212
+ PyThreadState * tstate = _PyThreadState_GET ();
212
213
if (tstate == NULL ) {
213
214
/* just in case but very unlikely... */
214
215
PyErr_SetString (PyExc_RuntimeError ,
You can’t perform that action at this time.
0 commit comments