summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph Reiter <reiter.christoph@gmail.com>2020-10-06 11:29:56 +0200
committerChristoph Reiter <reiter.christoph@gmail.com>2020-10-06 11:31:01 +0200
commit2913e72d85269d6b307dc054946a88cbba6707de (patch)
tree04b45ff40a102c30c020a20f18df9934dc4f85a0
parentb991b9d31d224b50e64664845f3d57677097ca7d (diff)
downloadpygobject-2913e72d85269d6b307dc054946a88cbba6707de.tar.gz
Don't call PyEval_InitThreads() with Python 3.9+
The GIL is now created by Python at initialization time no matter what. PyEval_InitThreads() triggers a deprecation warning and will be removed in 3.10 so don't use it with 3.9+.
-rw-r--r--gi/gimodule.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/gi/gimodule.c b/gi/gimodule.c
index 890a6bfa..0901e738 100644
--- a/gi/gimodule.c
+++ b/gi/gimodule.c
@@ -2522,12 +2522,16 @@ PYGI_MODINIT_FUNC PyInit__gi(void) {
module = PyModule_Create(&__gimodule);
PyObject *module_dict = PyModule_GetDict (module);
+#if PY_VERSION_HEX < 0x03090000
+ /* Deprecated since 3.9 */
+
/* Always enable Python threads since we cannot predict which GI repositories
* might accept Python callbacks run within non-Python threads or might trigger
* toggle ref notifications.
* See: https://bugzilla.gnome.org/show_bug.cgi?id=709223
*/
PyEval_InitThreads ();
+#endif
PyModule_AddStringConstant(module, "__package__", "gi._gi");