aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Python/_warnings.c
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2020-06-10 20:08:26 +0200
committerGitHub <noreply@github.com>2020-06-10 20:08:26 +0200
commit1bcc32f0620d2e99649a6d423284d9496b7b3548 (patch)
treef42552bb9acbb5d9fd90b47f95a63487ab438262 /Python/_warnings.c
parent9c24e2e4c10705d95258558348417a28007dac66 (diff)
downloadcpython-1bcc32f0620d2e99649a6d423284d9496b7b3548.tar.gz
cpython-1bcc32f0620d2e99649a6d423284d9496b7b3548.zip
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.
Diffstat (limited to 'Python/_warnings.c')
-rw-r--r--Python/_warnings.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/Python/_warnings.c b/Python/_warnings.c
index 4d65bb30c8e..86bbfa1c8db 100644
--- a/Python/_warnings.c
+++ b/Python/_warnings.c
@@ -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. */