diff options
author | Miodrag Milanovic <mmicko@gmail.com> | 2018-06-27 11:45:19 +0200 |
---|---|---|
committer | Miodrag Milanovic <mmicko@gmail.com> | 2018-06-27 11:45:19 +0200 |
commit | bafb4702c7176a08e4a9b2088297071a7bed6656 (patch) | |
tree | a59132f64cba845f2b65c02441229fa26a00aa9e /common/pybindings.cc | |
parent | 9bb489936078980e98fc873845b2ca64ddb490fb (diff) | |
download | nextpnr-bafb4702c7176a08e4a9b2088297071a7bed6656.tar.gz nextpnr-bafb4702c7176a08e4a9b2088297071a7bed6656.tar.bz2 nextpnr-bafb4702c7176a08e4a9b2088297071a7bed6656.zip |
reinit python tab
Diffstat (limited to 'common/pybindings.cc')
-rw-r--r-- | common/pybindings.cc | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/common/pybindings.cc b/common/pybindings.cc index 13e0976c..02c39fa3 100644 --- a/common/pybindings.cc +++ b/common/pybindings.cc @@ -127,11 +127,9 @@ BOOST_PYTHON_MODULE(MODULE_NAME) class_<Context, Context *, bases<Arch>, boost::noncopyable>("Context", no_init).def("checksum", &Context::checksum); } -void arch_appendinittab() { PyImport_AppendInittab(TOSTRING(MODULE_NAME), PYINIT_MODULE_NAME); } - static wchar_t *program; -void init_python(const char *executable) +void init_python(const char *executable,bool first) { #ifdef MAIN_EXECUTABLE program = Py_DecodeLocale(executable, NULL); @@ -140,11 +138,15 @@ void init_python(const char *executable) exit(1); } try { - PyImport_AppendInittab(TOSTRING(MODULE_NAME), PYINIT_MODULE_NAME); - emb::append_inittab(); + if (first) + { + PyImport_AppendInittab(TOSTRING(MODULE_NAME), PYINIT_MODULE_NAME); + emb::append_inittab(); + } Py_SetProgramName(program); Py_Initialize(); - PyImport_ImportModule(TOSTRING(MODULE_NAME)); + if (first) + PyImport_ImportModule(TOSTRING(MODULE_NAME)); } catch (boost::python::error_already_set const &) { // Parse and output the exception std::string perror_str = parse_python_exception(); |