python: revert changes
@@ -71,7 +71,6 @@ typedef struct
PyObject * instance;
int printError;
int shutdown;
- int subinterpreter;
} moduleData;
static int Python_AppendToSysPath (const char * path)
@@ -163,7 +162,6 @@ static void Python_Shutdown (moduleData * data)
/* destroy python if plugin isn't used anymore */
if (Py_IsInitialized ())
{
- // Do we have a sub-interpreter?
if (data->tstate)
{
Python_LockSwap pylock (data->tstate);
@@ -207,8 +205,6 @@ int PYTHON_PLUGIN_FUNCTION (Open) (ckdb::Plugin * handle, ckdb::Key * errorKey)
* expected behaviour without worring about default values
*/
data->shutdown = (ksLookupByName (config, "/shutdown", 0) && !!strcmp (keyString (ksLookupByName (config, "/shutdown", 0)), "0"));
- data->subinterpreter = (ksLookupByName (config, "/subinterpreter", 0) &&
- !!strcmp (keyString (ksLookupByName (config, "/subinterpreter", 0)), "0"));
{
/* initialize python interpreter if necessary */
@@ -233,11 +229,7 @@ int PYTHON_PLUGIN_FUNCTION (Open) (ckdb::Plugin * handle, ckdb::Key * errorKey)
/* acquire GIL */
Python_LockSwap pylock (nullptr);
- if (data->subinterpreter)
- {
- /* Create a new sub-interpreter.
- This is incompatible with PyGILState_Ensure, see directly above
- https://docs.python.org/3/c-api/init.html#c.PyGILState_Ensure */
+ /* create a new sub-interpreter */
data->tstate = Py_NewInterpreter ();
if (data->tstate == nullptr)
{
@@ -245,7 +237,6 @@ int PYTHON_PLUGIN_FUNCTION (Open) (ckdb::Plugin * handle, ckdb::Key * errorKey)
goto error;
}
PyThreadState_Swap (data->tstate);
- }
/* import kdb */
PyObject * kdbModule = PyImport_ImportModule ("kdb");
@@ -316,7 +307,6 @@ error:
/* destroy python */
Python_Shutdown (data);
delete data;
- elektraPluginSetData (handle, nullptr);
return -1;
}
@@ -330,7 +320,6 @@ int PYTHON_PLUGIN_FUNCTION (Close) (ckdb::Plugin * handle, ckdb::Key * errorKey)
/* destroy python */
Python_Shutdown (data);
delete data;
- elektraPluginSetData (handle, nullptr);
return ret;
}
