summaryrefslogtreecommitdiffstats
path: root/Modules/faulthandler.c
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2021-02-19 12:21:28 (GMT)
committerGitHub <noreply@github.com>2021-02-19 12:21:28 (GMT)
commit5592f2b9daa24bf74cc616abcc40a29da2bdccb2 (patch)
tree532d865e35e6a5338310bb093841f30a7897d964 /Modules/faulthandler.c
parent2bb0bf4dd8c0bd4d23eb04afce1a5eeee8e07982 (diff)
downloadcpython-5592f2b9daa24bf74cc616abcc40a29da2bdccb2.zip
cpython-5592f2b9daa24bf74cc616abcc40a29da2bdccb2.tar.gz
cpython-5592f2b9daa24bf74cc616abcc40a29da2bdccb2.tar.bz2
bpo-43268: Replace _PyThreadState_GET() with _PyInterpreterState_GET() (GH-24576)
Replace _PyThreadState_GET() with _PyInterpreterState_GET() in functions which only need the current interpreter, but don't need the current Python thread state. Replace also _PyThreadState_UncheckedGet() with _PyThreadState_GET() in faulthandler.c, since _PyThreadState_UncheckedGet() is just an alias to _PyThreadState_GET() in practice.
Diffstat (limited to 'Modules/faulthandler.c')
-rw-r--r--Modules/faulthandler.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/Modules/faulthandler.c b/Modules/faulthandler.c
index da8b774..350f4cf 100644
--- a/Modules/faulthandler.c
+++ b/Modules/faulthandler.c
@@ -1,6 +1,7 @@
#include "Python.h"
#include "pycore_initconfig.h" // _PyStatus_ERR
#include "pycore_pyerrors.h" // _Py_DumpExtensionModules
+#include "pycore_pystate.h" // _PyThreadState_GET()
#include "pycore_traceback.h" // _Py_DumpTracebackThreads
#include <signal.h>
#include <object.h>
@@ -208,7 +209,7 @@ faulthandler_get_fileno(PyObject **file_ptr)
static PyThreadState*
get_thread_state(void)
{
- PyThreadState *tstate = _PyThreadState_UncheckedGet();
+ PyThreadState *tstate = _PyThreadState_GET();
if (tstate == NULL) {
/* just in case but very unlikely... */
PyErr_SetString(PyExc_RuntimeError,