diff options
author | Benedikt Tutzer <e1225461@student.tuwien.ac.at> | 2019-04-04 10:35:01 +0200 |
---|---|---|
committer | Benedikt Tutzer <e1225461@student.tuwien.ac.at> | 2019-04-04 10:35:01 +0200 |
commit | cae657cebd1f4aa119a1264f80d89294a23be845 (patch) | |
tree | a5d97eadc94d6a2ceb23ef71b64a23e85f7c687d | |
parent | 574dfb2ef9b31ff1396e48cb37b5f59996c5db24 (diff) | |
download | yosys-cae657cebd1f4aa119a1264f80d89294a23be845.tar.gz yosys-cae657cebd1f4aa119a1264f80d89294a23be845.tar.bz2 yosys-cae657cebd1f4aa119a1264f80d89294a23be845.zip |
Used PyImport_ImportModule instead of PyImport_Import to avoid the explicit conversion to a python string
-rw-r--r-- | passes/cmds/plugin.cc | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/passes/cmds/plugin.cc b/passes/cmds/plugin.cc index 5da8f5b0b..4c16b56c4 100644 --- a/passes/cmds/plugin.cc +++ b/passes/cmds/plugin.cc @@ -60,17 +60,9 @@ void load_plugin(std::string filename, std::vector<std::string> aliases) std::string path(full_path.parent_path().c_str()); filename = full_path.filename().c_str(); filename = filename.substr(0,filename.size()-3); - PyRun_SimpleString(("sys.path.insert(0,\""+path+"\")").c_str()); + PyRun_SimpleString(("sys.path.insert(0,\""+path+"\")").c_str()); PyErr_Print(); - PyObject *filename_p = PyUnicode_FromString(filename.c_str()); - - if(filename_p == NULL) - { - PyErr_Print(); - log_cmd_error("Issues converting `%s' to Python\n", full_path.filename().c_str()); - return; - } - PyObject *module_p = PyImport_Import(filename_p); + PyObject *module_p = PyImport_ImportModule(filename.c_str()); if(module_p == NULL) { PyErr_Print(); |