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
commit44eafeee62e6982131c62df6f74335114ca53024 (patch)
tree1cdf833b0a76e52630d717202398ced5900e11e9 /src/modules/rlm_python
parentAdding upstream version 3.2.3+dfsg. (diff)
downloadfreeradius-44eafeee62e6982131c62df6f74335114ca53024.tar.xz
freeradius-44eafeee62e6982131c62df6f74335114ca53024.zip
Adding upstream version 3.2.5+dfsg.upstream/3.2.5+dfsgupstream
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);
/*