Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DISPATCH-2360: call Py_Initialize before any other python C #1671

Merged
merged 1 commit into from
Dec 2, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/python_embedded.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,13 @@ void qd_python_initialize(qd_dispatch_t *qd, const char *python_pkgdir)
{
log_source = qd_log_source("PYTHON");
dispatch = qd;
if (python_pkgdir)
dispatch_python_pkgdir = PyUnicode_FromString(python_pkgdir);

Py_Initialize();
#if PY_VERSION_HEX < 0x03070000
PyEval_InitThreads(); // necessary for Python 3.6 and older versions
#endif
if (python_pkgdir)
dispatch_python_pkgdir = PyUnicode_FromString(python_pkgdir);
qd_python_setup();
PyEval_SaveThread(); // drop the Python GIL; we will reacquire it in other threads as needed
}
Expand Down