Skip to content

Commit 18bc7c2

Browse files
committed
Make current_tstate a global, _PyThreadState_Current. This is to
support a macro in pystate.h.
1 parent dfaac4d commit 18bc7c2

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

Python/pystate.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ PERFORMANCE OF THIS SOFTWARE.
4242

4343
static PyInterpreterState *interp_head = NULL;
4444

45-
static PyThreadState *current_tstate = NULL;
45+
PyThreadState *_PyThreadState_Current = NULL;
4646

4747

4848
PyInterpreterState *
@@ -180,7 +180,7 @@ PyThreadState_Delete(tstate)
180180
PyThreadState **p;
181181
if (tstate == NULL)
182182
Py_FatalError("PyThreadState_Delete: NULL tstate");
183-
if (tstate == current_tstate)
183+
if (tstate == _PyThreadState_Current)
184184
Py_FatalError("PyThreadState_Delete: tstate is still current");
185185
interp = tstate->interp;
186186
if (interp == NULL)
@@ -200,20 +200,20 @@ PyThreadState_Delete(tstate)
200200
PyThreadState *
201201
PyThreadState_Get()
202202
{
203-
if (current_tstate == NULL)
203+
if (_PyThreadState_Current == NULL)
204204
Py_FatalError("PyThreadState_Get: no current thread");
205205

206-
return current_tstate;
206+
return _PyThreadState_Current;
207207
}
208208

209209

210210
PyThreadState *
211211
PyThreadState_Swap(new)
212212
PyThreadState *new;
213213
{
214-
PyThreadState *old = current_tstate;
214+
PyThreadState *old = _PyThreadState_Current;
215215

216-
current_tstate = new;
216+
_PyThreadState_Current = new;
217217

218218
return old;
219219
}
@@ -227,10 +227,10 @@ PyThreadState_Swap(new)
227227
PyObject *
228228
PyThreadState_GetDict()
229229
{
230-
if (current_tstate == NULL)
230+
if (_PyThreadState_Current == NULL)
231231
Py_FatalError("PyThreadState_GetDict: no current thread");
232232

233-
if (current_tstate->dict == NULL)
234-
current_tstate->dict = PyDict_New();
235-
return current_tstate->dict;
233+
if (_PyThreadState_Current->dict == NULL)
234+
_PyThreadState_Current->dict = PyDict_New();
235+
return _PyThreadState_Current->dict;
236236
}

0 commit comments

Comments
 (0)