[C++-sig] PyFinalize Safety

Paul Guse paul at mustagh.com
Fri Feb 16 20:15:26 CET 2007


> Stefan wrote:
>
>> By main dictionary I mean the "__dict__" attribute to the main module.
>> Checking the documentation, exec/exec_file  seems like the way to go,
>> however, I can't actually find exec.hpp or import.hpp in my boost build. 
>> I'm
>> using 1_33_1 and used the installer(win) from boost.consulting. Any 
>> thoughts
>> on why I would not have those 2 headers? Newer version? My version of
>> python.hpp does not include those files as well. Is this a new feature?
>
> <sarcasm> I only added that code 1 1/2 years ago. Not enough time
> to make it into a release yet.</sarcasm>
>
>> The solution I proposed came about due to the main module namespace
>> retaining enties in it's _dict_ upon successive sessions (embeded).
>> So if I run the example code without clearing and updating the 
>> dictionary,
>> then variables defined in once session will persist to the next.
>> I'm eager to try your solution.
>
> You don't have to use the main dictionary. I believe you may create a new
> one, as long as you make sure that all the required builtin objects are
> there (copied from the main one, probably).
>

That's much better. Using a copy of the main dictionary is much cleaner.
Thanks for your help Stefan.


> HTH,
> Stefan
>
> -- 
>
>      ...ich hab' noch einen Koffer in Berlin...
> _______________________________________________
> C++-sig mailing list
> C++-sig at python.org
> http://mail.python.org/mailman/listinfo/c++-sig
> 




More information about the Cplusplus-sig mailing list