summaryrefslogtreecommitdiffstats
path: root/src/modules/rlm_python
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-08-26 10:41:52 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-08-26 10:41:52 +0000
commitde8bf9112695763664912e340b265fa898188460 (patch)
tree9bcd5f8d45fc3b81174d3de8abfd573b68e9d7f6 /src/modules/rlm_python
parentAdding debian version 3.2.3+dfsg-2. (diff)
downloadfreeradius-de8bf9112695763664912e340b265fa898188460.tar.xz
freeradius-de8bf9112695763664912e340b265fa898188460.zip
Merging upstream version 3.2.5+dfsg.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/modules/rlm_python')
-rw-r--r--src/modules/rlm_python/rlm_python.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/modules/rlm_python/rlm_python.c b/src/modules/rlm_python/rlm_python.c
index 2adba0e..412859c 100644
--- a/src/modules/rlm_python/rlm_python.c
+++ b/src/modules/rlm_python/rlm_python.c
@@ -996,6 +996,7 @@ static void *dlopen_libpython(int flags)
static int python_interpreter_init(rlm_python_t *inst, CONF_SECTION *conf)
{
int i;
+ bool locked = false;
/*
* Explicitly load libpython, so symbols will be available to lib-dynload modules
@@ -1023,6 +1024,7 @@ static int python_interpreter_init(rlm_python_t *inst, CONF_SECTION *conf)
Py_InitializeEx(0); /* Don't override signal handlers - noop on subs calls */
PyEval_InitThreads(); /* This also grabs a lock (which we then need to release) */
main_interpreter = PyThreadState_Get(); /* Store reference to the main interpreter */
+ locked = true;
}
rad_assert(PyEval_ThreadsInitialized());
@@ -1041,6 +1043,7 @@ static int python_interpreter_init(rlm_python_t *inst, CONF_SECTION *conf)
inst->sub_interpreter = main_interpreter;
}
+ if (!locked) PyEval_AcquireThread(inst->sub_interpreter);
PyThreadState_Swap(inst->sub_interpreter);
/*