bpo-30860: Consolidate stateful runtime globals. (#3397)
* group the (stateful) runtime globals into various topical structs
* consolidate the topical structs under a single top-level _PyRuntimeState struct
* add a check-c-globals.py script that helps identify runtime globals
Other globals are excluded (see globals.txt and check-c-globals.py).
diff --git a/Modules/_io/bufferedio.c b/Modules/_io/bufferedio.c
index ba0932c..b2b9ade 100644
--- a/Modules/_io/bufferedio.c
+++ b/Modules/_io/bufferedio.c
@@ -9,6 +9,7 @@
#define PY_SSIZE_T_CLEAN
#include "Python.h"
+#include "internal/pystate.h"
#include "structmember.h"
#include "pythread.h"
#include "_iomodule.h"
@@ -275,7 +276,7 @@
"reentrant call inside %R", self);
return 0;
}
- relax_locking = (_Py_Finalizing != NULL);
+ relax_locking = _Py_IsFinalizing();
Py_BEGIN_ALLOW_THREADS
if (!relax_locking)
st = PyThread_acquire_lock(self->lock, 1);