aboutsummaryrefslogtreecommitdiffstats
path: root/3rdparty/python-console/modified
diff options
context:
space:
mode:
authorMiodrag Milanović <mmicko@gmail.com>2020-11-13 16:05:16 +0100
committerGitHub <noreply@github.com>2020-11-13 16:05:16 +0100
commit319046fed73967004611213188098d3364faa5f2 (patch)
treeea0bb26a22bd0fdac41c924606d43d9d02136177 /3rdparty/python-console/modified
parentcf331ca2a7fa92d3414fabf003ce6fc7b515f76b (diff)
parente15b339d41f8ccfe90f712e9c87dbeb3da3426e0 (diff)
downloadnextpnr-319046fed73967004611213188098d3364faa5f2.tar.gz
nextpnr-319046fed73967004611213188098d3364faa5f2.tar.bz2
nextpnr-319046fed73967004611213188098d3364faa5f2.zip
Merge pull request #513 from YosysHQ/python_interpreter
Do not create new python interpreter
Diffstat (limited to '3rdparty/python-console/modified')
-rw-r--r--3rdparty/python-console/modified/pyinterpreter.cc13
1 files changed, 3 insertions, 10 deletions
diff --git a/3rdparty/python-console/modified/pyinterpreter.cc b/3rdparty/python-console/modified/pyinterpreter.cc
index cbb6322f..bf6d9620 100644
--- a/3rdparty/python-console/modified/pyinterpreter.cc
+++ b/3rdparty/python-console/modified/pyinterpreter.cc
@@ -28,8 +28,6 @@ SOFTWARE.
#include <memory>
#include "pyredirector.h"
-static PyThreadState *MainThreadState = NULL;
-
static PyThreadState *m_threadState = NULL;
static PyObject *glb = NULL;
static PyObject *loc = NULL;
@@ -125,9 +123,8 @@ void pyinterpreter_preinit()
void pyinterpreter_initialize()
{
PyEval_InitThreads();
- MainThreadState = PyEval_SaveThread();
- PyEval_AcquireThread(MainThreadState);
- m_threadState = Py_NewInterpreter();
+ m_threadState = PyEval_SaveThread();
+ PyEval_AcquireThread(m_threadState);
PyObject *module = PyImport_ImportModule("__main__");
loc = glb = PyModule_GetDict(module);
@@ -147,11 +144,7 @@ void pyinterpreter_finalize()
{
m_suggestions.clear();
- PyEval_AcquireThread(m_threadState);
- Py_EndInterpreter(m_threadState);
- PyEval_ReleaseLock();
-
- PyEval_RestoreThread(MainThreadState);
+ PyEval_RestoreThread(m_threadState);
}
void pyinterpreter_aquire()