summaryrefslogtreecommitdiff
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-04-24 11:25:22 +0200
commit7edc361f78a676e95ca3bc7917d3683201e996a7 (patch)
treed8c1740461f07d48f9f37ae277833ee813bf9218
parent5ae23722719b9fefdd05693ca996958fb776100f (diff)
downloadpygobject-7edc361f78a676e95ca3bc7917d3683201e996a7.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.
-rw-r--r--gi/gimodule.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/gi/gimodule.c b/gi/gimodule.c
index 2d1dfe20..fa788121 100644
--- a/gi/gimodule.c
+++ b/gi/gimodule.c
@@ -2522,8 +2522,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