WeakRefs, callbacks and GC when program quits

Martin v. Löwis loewis at informatik.hu-berlin.de
Wed Aug 7 18:36:33 CEST 2002

daniel_shane_eicon_junk at hotmail.com (Daniel Shane) writes:

> Unfortunately, this can lead to some errors because I believe that the
> memory content at that time is uncertain. 

The memory content is not uncertain. It is just that certain functions
are not available anymore.

> Exception exceptions.SystemError: 'codec module not properly
> initialized' when attempting to access a method in the class that
> defined the callback.

I believe it is a bug that the codec module is not available anymore
when the modules are cleared; please produce a self-contained example,
and report it as a bug to sourceforge.

> I propose to add a method in weakref called clear_all_callbacks that
> could be called to ensure that no callbacks will be called upon
> termination.
> What do you think?

I think there is a simpler solution to that problem.


More information about the Python-list mailing list