[pygobject] Call PyEval_InitThreads() with PyPy for Python 3.9



commit dad6c1aacd0fc9517e4bf7213ae90832f60912c5
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 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


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