[Python-bugs-list] [ python-Bugs-813299 ] Weak references and bound functions interact in a bad way

SourceForge.net noreply at sourceforge.net
Fri Sep 26 17:20:11 EDT 2003


Bugs item #813299, was opened at 2003-09-26 21:20
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=813299&group_id=5470

Category: Python Interpreter Core
Group: Python 2.3
Status: Open
Resolution: None
Priority: 5
Submitted By: Matthias Klose (doko)
Assigned to: Nobody/Anonymous (nobody)
Summary: Weak references and bound functions interact in a bad way

Initial Comment:
[forwarded from http://bugs.debian.org/211129]



>>> import weakref

>>> class Foo:

...     def bar(self):

...             print 'Hello'

... 

>>> x=Foo()

>>> y=weakref.ref(x.bar)

>>> y

<weakref at 0x4021cb94; dead>



  This behavior is self-evidently wrong, and seems to

be due to an

implementation detail of Python.  There is a workaround

available here:

http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/81253

(I haven't

examined it closely, but it looks like it should work)

 Nevertheless, this

should be fixed eventually IMO.





----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=813299&group_id=5470



More information about the Python-bugs-list mailing list