Skip to content

Commit ad53d67

Browse files
authored
DISPATCH-2360: call Py_Initialize before any other python C (#1671)
This is a backport of a skupper-router fix from * skupperproject/skupper-router#1307
1 parent c0ccdb1 commit ad53d67

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/python_embedded.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,13 @@ void qd_python_initialize(qd_dispatch_t *qd, const char *python_pkgdir)
5050
{
5151
log_source = qd_log_source("PYTHON");
5252
dispatch = qd;
53-
if (python_pkgdir)
54-
dispatch_python_pkgdir = PyUnicode_FromString(python_pkgdir);
5553

5654
Py_Initialize();
5755
#if PY_VERSION_HEX < 0x03070000
5856
PyEval_InitThreads(); // necessary for Python 3.6 and older versions
5957
#endif
58+
if (python_pkgdir)
59+
dispatch_python_pkgdir = PyUnicode_FromString(python_pkgdir);
6060
qd_python_setup();
6161
PyEval_SaveThread(); // drop the Python GIL; we will reacquire it in other threads as needed
6262
}

0 commit comments

Comments
 (0)