[pygobject/pygobject-3-42] Call PyEval_InitThreads() with PyPy for Python 3.9



commit 7edc361f78a676e95ca3bc7917d3683201e996a7
Author: Christoph Reiter <reiter christoph gmail com>
Date:   Sat Mar 26 20:00:13 2022 +0100

    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.

 gi/gimodule.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
---
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


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]