]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
pylibsmb: do not use obsolete PyEval_InitThreads() for Python > 3.6
authorDmitry Antipov <dantipov@cloudlinux.com>
Wed, 8 Feb 2023 08:59:59 +0000 (11:59 +0300)
committerDouglas Bagnall <dbagnall@samba.org>
Wed, 12 Mar 2025 04:36:21 +0000 (04:36 +0000)
Do not use obsolete PyEval_InitThreads() for Python > 3.6:

../../source3/libsmb/pylibsmb.c: In function ‘py_cli_state_setup_mt_ev’:
../../source3/libsmb/pylibsmb.c:271:9: warning: ‘PyEval_InitThreads’ is
deprecated [-Wdeprecated-declarations]
  271 |         PyEval_InitThreads();
      |         ^~~~~~~~~~~~~~~~~~
In file included from /usr/include/python3.11/Python.h:95,
                 from ../../source3/libsmb/pylibsmb.c:48:
/usr/include/python3.11/ceval.h:132:37: note: declared here
  132 | Py_DEPRECATED(3.9) PyAPI_FUNC(void) PyEval_InitThreads(void);

Signed-off-by: Dmitry Antipov <dantipov@cloudlinux.com>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Autobuild-User(master): Douglas Bagnall <dbagnall@samba.org>
Autobuild-Date(master): Wed Mar 12 04:36:21 UTC 2025 on atb-devel-224

source3/libsmb/pylibsmb.c

index 19e6f4e717f7a8f54aeb0a47f798dc18478bf601..bfbddbd5e7b8a4f6e6b24e0e069c5f6ffcaa17b1 100644 (file)
@@ -271,7 +271,13 @@ static bool py_cli_state_setup_mt_ev(struct py_cli_state *self)
                goto fail;
        }
 
+#if PY_VERSION_HEX < 0x03070000
+       /*
+        * Should be explicitly called in 3.6 and older, see
+        * https://docs.python.org/3/c-api/init.html#c.PyEval_InitThreads
+        */
        PyEval_InitThreads();
+#endif
 
        ret = pthread_create(&t->id, NULL, py_cli_state_poll_thread, self);
        if (ret != 0) {