[pygobject] Don't call PyEval_InitThreads() with Python 3.9+
- From: Christoph Reiter <creiter src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pygobject] Don't call PyEval_InitThreads() with Python 3.9+
- Date: Tue, 6 Oct 2020 11:41:39 +0000 (UTC)
commit 2913e72d85269d6b307dc054946a88cbba6707de
Author: Christoph Reiter <reiter christoph gmail com>
Date: Tue Oct 6 11:29:56 2020 +0200
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+.
gi/gimodule.c | 4 ++++
1 file changed, 4 insertions(+)
---
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");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]