[C++-sig] Abstract class instances to-python conversion

Valentin Perrelle valentin.perrelle at orange.fr
Tue Aug 2 11:01:18 CEST 2011


> In cpp it would be like:
> import('sys').attr('modules')['mymodule'].del()
Thank you, it worked. However, I believe it would only remove one 
module, not any other module imported. I tried to clear the dictionnary, 
which worked in Python, i didn't achieve to reproduce this in c++. 
Anyway, this would free memory occupied by cycles in the python 
reference graph. But this is only a matter of memory leak, not really 
relevent in my context.

I tried another solution, which doesn't seem at first very suitable. I 
created a subinterpreter for each new execution of the script. Since 
there is never 2 execution at the same time, this ensure a good 
independance between distinct executions. It worked well. This may be a 
good solution, at least until the Py_Finalize issue is solved.

Thank you again for your help.



More information about the Cplusplus-sig mailing list