From: Dmitry Antipov Date: Wed, 8 Feb 2023 08:59:59 +0000 (+0300) Subject: pylibsmb: do not use obsolete PyEval_InitThreads() for Python > 3.6 X-Git-Tag: tevent-0.17.0~564 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5e8f998efa54d276d02b90664125a7b577e091b9;p=thirdparty%2Fsamba.git pylibsmb: do not use obsolete PyEval_InitThreads() for Python > 3.6 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 Reviewed-by: Volker Lendecke Reviewed-by: Douglas Bagnall Autobuild-User(master): Douglas Bagnall Autobuild-Date(master): Wed Mar 12 04:36:21 UTC 2025 on atb-devel-224 --- diff --git a/source3/libsmb/pylibsmb.c b/source3/libsmb/pylibsmb.c index 19e6f4e717f..bfbddbd5e7b 100644 --- a/source3/libsmb/pylibsmb.c +++ b/source3/libsmb/pylibsmb.c @@ -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) {