[Python-Dev] Module cleanup improvement

Alan McIntyre alan.mcintyre at gmail.com
Tue May 22 02:17:02 CEST 2007

Hi all,

Bug #1717900 has an example of a script that causes a (cryptic, IMO)
error during module cleanup since instances of a class just happen to
get destroyed after their class is destroyed, and the __del__ method
manipulates a class attribute.  As I understand it this is expected
under the behavior outlined here:

Adding a step C1.5 which removes only objects that return true for
PyInstance_Check seems to prevent the problem exhibited by this bug (I
tried it out locally on the trunk and it doesn't cause any problems
with the regression test suite).  Is there any reason that adding such
a step to module cleanup would be a bad idea?


More information about the Python-Dev mailing list