summaryrefslogtreecommitdiffstats
path: root/Parser/pgenmain.c
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2016-03-14 21:07:55 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2016-03-14 21:07:55 (GMT)
commit8a1be61849341528c866924cf69d378ce7790889 (patch)
tree0b59fbc22edbd703ded539758aae78382d4eec7d /Parser/pgenmain.c
parent08572f68a980576e883e4eba1227b59782d5192e (diff)
downloadcpython-8a1be61849341528c866924cf69d378ce7790889.zip
cpython-8a1be61849341528c866924cf69d378ce7790889.tar.gz
cpython-8a1be61849341528c866924cf69d378ce7790889.tar.bz2
Add more checks on the GIL
Issue #10915, #15751, #26558: * PyGILState_Check() now returns 1 (success) before the creation of the GIL and after the destruction of the GIL. It allows to use the function early in Python initialization and late in Python finalization. * Add a flag to disable PyGILState_Check(). Disable PyGILState_Check() when Py_NewInterpreter() is called * Add assert(PyGILState_Check()) to: _Py_dup(), _Py_fstat(), _Py_read() and _Py_write()
Diffstat (limited to 'Parser/pgenmain.c')
-rw-r--r--Parser/pgenmain.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/Parser/pgenmain.c b/Parser/pgenmain.c
index 3ca4afe..671a0cb 100644
--- a/Parser/pgenmain.c
+++ b/Parser/pgenmain.c
@@ -37,6 +37,14 @@ Py_Exit(int sts)
exit(sts);
}
+#ifdef WITH_THREAD
+/* Needed by obmalloc.c */
+int PyGILState_Check(void)
+{
+ return 1;
+}
+#endif
+
int
main(int argc, char **argv)
{