Author stutzbach
Recipients ajaksu2, amaury.forgeotdarc, flox, pitrou, stutzbach
Date 2010-03-29.22:21:32
SpamBayes Score 1.13712e-11
Marked as misclassified No
Message-id <>
Now that WeakSet has been backported to trunk, I've backported the fix for this reference-leak (patch with test case attached).

However, after making the patch, I discovered that old-style classes are not weak-referenceable.  Consequently, the patch is not suitable for commiting.  

If old-style classes can be made weak-referenceable, then the patch should work.  If not, then this bug is essentially impossible to solve in 2.x unless the ABC cache is done away with entirely.

Other notes:

Since is imported during bootstrapping before paths are set up, I needed to add _weakref as a built-in module.  (It's already a built-in module in the py3k branch.)

Since the patch tweaks Modules/Setup.dist, you need to "make distclean" and rerun ./configure after applying the patch.

Also, on unpatched trunk the example posted by Amaury no longer seems to trigger the issue.  However, the example I posted in Issue 8022 still triggers the leak.  I used that as the basis for the test case in the patch.
Date User Action Args
2010-03-29 22:21:36stutzbachsetrecipients: + stutzbach, amaury.forgeotdarc, pitrou, ajaksu2, flox
2010-03-29 22:21:36stutzbachsetmessageid: <>
2010-03-29 22:21:34stutzbachlinkissue2521 messages
2010-03-29 22:21:34stutzbachcreate