We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent b76d90f commit b1c2475Copy full SHA for b1c2475
c++/cpp2py/pyref.hpp
@@ -101,7 +101,8 @@ namespace cpp2py {
101
/// Import the module and returns a pyref to it
102
static pyref module(std::string const &module_name) {
103
// Maybe the module was already imported?
104
- PyObject *mod = PyImport_GetModule(PyUnicode_FromString(module_name.c_str()));
+ pyref mod_name = PyUnicode_FromString(module_name.c_str());
105
+ PyObject *mod = PyImport_GetModule(mod_name);
106
107
// If not, import normally
108
if (mod == nullptr) mod = PyImport_ImportModule(module_name.c_str());
0 commit comments