summaryrefslogtreecommitdiff
path: root/gi
diff options
context:
space:
mode:
authorChristoph Reiter <reiter.christoph@gmail.com>2022-03-26 20:00:13 +0100
committerChristoph Reiter <reiter.christoph@gmail.com>2022-03-27 08:14:00 +0000
commitdad6c1aacd0fc9517e4bf7213ae90832f60912c5 (patch)
tree5f68e45825cf16d92f6ced92d761a66205d01a35 /gi
parentce09310f66b3ddb28650daf4ba71cce0c78925c5 (diff)
downloadpygobject-dad6c1aacd0fc9517e4bf7213ae90832f60912c5.tar.gz
Call PyEval_InitThreads() with PyPy for Python 3.9
In theory it should no longer be needed, but PyPy hasn't updated this part of their implementation yet, and not initing threads will lead to crashes due to missing GIL init.
Diffstat (limited to 'gi')
-rw-r--r--gi/gimodule.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/gi/gimodule.c b/gi/gimodule.c
index 02daba85..b7ef6beb 100644
--- a/gi/gimodule.c
+++ b/gi/gimodule.c
@@ -2531,8 +2531,9 @@ PYGI_MODINIT_FUNC PyInit__gi(void) {
module = PyModule_Create(&__gimodule);
PyObject *module_dict = PyModule_GetDict (module);
-#if PY_VERSION_HEX < 0x03090000
+#if PY_VERSION_HEX < 0x03090000 || defined(PYPY_VERSION)
/* Deprecated since 3.9 */
+ /* Except in PyPy it's still not a no-op: https://foss.heptapod.net/pypy/pypy/-/issues/3691 */
/* Always enable Python threads since we cannot predict which GI repositories
* might accept Python callbacks run within non-Python threads or might trigger