Daniel Stutzbach <dan...@stutzbachenterprises.com> added the comment:

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 abc.py 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.

----------
keywords: +patch
nosy: +stutzbach
Added file: http://bugs.python.org/file16690/abc_leak.patch

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue2521>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to