mirror of https://github.com/YosysHQ/yosys.git
Used PyImport_ImportModule instead of PyImport_Import to avoid the explicit conversion to a python string
This commit is contained in:
parent
574dfb2ef9
commit
cae657cebd
|
@ -60,17 +60,9 @@ void load_plugin(std::string filename, std::vector<std::string> aliases)
|
||||||
std::string path(full_path.parent_path().c_str());
|
std::string path(full_path.parent_path().c_str());
|
||||||
filename = full_path.filename().c_str();
|
filename = full_path.filename().c_str();
|
||||||
filename = filename.substr(0,filename.size()-3);
|
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();
|
PyErr_Print();
|
||||||
PyObject *filename_p = PyUnicode_FromString(filename.c_str());
|
PyObject *module_p = PyImport_ImportModule(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);
|
|
||||||
if(module_p == NULL)
|
if(module_p == NULL)
|
||||||
{
|
{
|
||||||
PyErr_Print();
|
PyErr_Print();
|
||||||
|
|
Loading…
Reference in New Issue