Having successfully embedded in the past multiple parallel Lua interpreters in C/C++ code (with threads running muliple cores), I thought doing the same using Python 3.13 configured with --disable-gil
. However, in trying to do so, if I include the following code
PyStatus status;
PyConfig config;
PyConfig_InitPythonConfig(&config);
/* optional but recommended */
status = PyConfig_SetBytesString(&config, &config.program_name, "PingPong");
PyConfig_Clear(&config);
PyRun_SimpleString("from time import time,ctimen"
"print('Today is', ctime(time()))n");
… in each worker, when trying to run I obtain the runtime error msg:
Fatal Python error: _PyImport_Init: global import state already initialized
Is this now possible with NOGIL Python (3.13), and if so, how? Thanks.