summaryrefslogtreecommitdiff
path: root/Python/_warnings.c
diff options
context:
space:
mode:
Diffstat (limited to 'Python/_warnings.c')
-rw-r--r--Python/_warnings.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/Python/_warnings.c b/Python/_warnings.c
index dd2b072d41..b8585d2047 100644
--- a/Python/_warnings.c
+++ b/Python/_warnings.c
@@ -1,4 +1,5 @@
#include "Python.h"
+#include "pycore_pyerrors.h"
#include "pycore_pystate.h"
#include "frameobject.h"
#include "clinic/_warnings.c.h"
@@ -27,10 +28,11 @@ static struct PyModuleDef warningsmodule;
static WarningsState *
_Warnings_GetState()
{
- PyThreadState *tstate = PyThreadState_GET();
+ PyThreadState *tstate = _PyThreadState_GET();
if (tstate == NULL) {
- PyErr_SetString(PyExc_RuntimeError,
- "_Warnings_GetState: could not identify current interpreter");
+ _PyErr_SetString(tstate, PyExc_RuntimeError,
+ "_Warnings_GetState: could not identify "
+ "current interpreter");
return NULL;
}
return &tstate->interp->warnings;