This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author pitrou
Recipients fdrake, pitrou, tim.peters
Date 2012-11-11.18:07:35
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1352657255.44.0.0509101223416.issue16453@psf.upfronthosting.co.za>
In-reply-to
Content
Dead weakrefs to a given object happen to be equal if they don't have a callback, but unequal if they do. However, they are always equal when alive:

>>> class O: pass
... 
>>> o = O()
>>> def cb(_): pass
... 
>>> q = weakref.ref(o)
>>> r = weakref.ref(o)
>>> s = weakref.ref(o, cb)
>>> t = weakref.ref(o, cb)
>>> q == r
True
>>> s == t
True
>>> del o
>>> q() is None
True
>>> q == r
True
>>> s == t
False

This may be related to the following optimization (?):

>>> q is r
True
>>> s is t
False
History
Date User Action Args
2012-11-11 18:07:35pitrousetrecipients: + pitrou, tim.peters, fdrake
2012-11-11 18:07:35pitrousetmessageid: <1352657255.44.0.0509101223416.issue16453@psf.upfronthosting.co.za>
2012-11-11 18:07:35pitroulinkissue16453 messages
2012-11-11 18:07:35pitroucreate