Python 3.1 bug: Objects in modules (m_size=-1) not deallocated

Last year, in July, I reported an issue to Python’s issue tracker. This issue can be seen at Since then, there has been no action on this bug from the developers.

The bug describes that every object stored in a module will not be deallocated if the module is deallocated and it’s m_size = -1 (which it should be if the module has no state). The problem seems to be that Python copies the dictionary of the module but forgets to decrease the reference count of the copy when the module is deallocated. This bug may have serious impact if objects are stored in the module which write status to a file when they are deallocated, because the deallocation functions are never called.


2 thoughts on “Python 3.1 bug: Objects in modules (m_size=-1) not deallocated

  1. hmm, that asigned but loewis even dont comment at all. Is there a better place to join the devs or loewis himself ?

  2. Not saying that this bug is not important, but using deallocation preparation functions (i.e. __del__) was never supposed to be reliable in Python. Python is not Java; it has always been recommended to use try..finally for finalizers.

Comments are closed.