Skip to content Skip to sidebar Skip to footer

What Happens During And After Boost::python::import?

The Boost documentation does not specify this. When I use boost::python::import, where exactly is the specified module imported? My guess would be in '__main__' (just to make sure)

Solution 1:

The underlying mechanism is PyImport_ImportModule, and no, it doesn't touch __main__. Successfully imported modules are inserted into sys.modules dict, so the object is not freed when you DECREF what the function returns — there is still at least that one reference alive.


Post a Comment for "What Happens During And After Boost::python::import?"