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.
Created on 2012年11月11日 18:07 by pitrou, last changed 2022年04月11日 14:57 by admin. This issue is now closed.
| Messages (5) | |||
|---|---|---|---|
| msg175378 - (view) | Author: Antoine Pitrou (pitrou) * (Python committer) | Date: 2012年11月11日 18:07 | |
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 |
|||
| msg175379 - (view) | Author: Antoine Pitrou (pitrou) * (Python committer) | Date: 2012年11月11日 18:11 | |
Aha, it is even worse: >>> o = O() >>> q = weakref.ref(o) >>> r = weakref.ref(o) >>> del o >>> q() is None True >>> q == r True >>> q != r True |
|||
| msg175380 - (view) | Author: Roundup Robot (python-dev) (Python triager) | Date: 2012年11月11日 18:42 | |
New changeset 590f1b55abea by Antoine Pitrou in branch '3.2': Issue #16453: Fix equality testing of dead weakref objects. http://hg.python.org/cpython/rev/590f1b55abea New changeset c00e2c1cb3a7 by Antoine Pitrou in branch '3.3': Issue #16453: Fix equality testing of dead weakref objects. http://hg.python.org/cpython/rev/c00e2c1cb3a7 New changeset 9e80ea48ff39 by Antoine Pitrou in branch 'default': Issue #16453: Fix equality testing of dead weakref objects. http://hg.python.org/cpython/rev/9e80ea48ff39 |
|||
| msg175381 - (view) | Author: Roundup Robot (python-dev) (Python triager) | Date: 2012年11月11日 18:49 | |
New changeset 13b74c0b040c by Antoine Pitrou in branch '2.7': Issue #16453: Fix equality testing of dead weakref objects. http://hg.python.org/cpython/rev/13b74c0b040c |
|||
| msg175383 - (view) | Author: Antoine Pitrou (pitrou) * (Python committer) | Date: 2012年11月11日 19:04 | |
Now fixed. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:57:38 | admin | set | github: 60657 |
| 2012年11月17日 02:47:49 | jcea | set | nosy:
+ jcea |
| 2012年11月11日 19:04:22 | pitrou | set | status: open -> closed resolution: fixed messages: + msg175383 stage: resolved |
| 2012年11月11日 18:49:06 | python-dev | set | messages: + msg175381 |
| 2012年11月11日 18:42:01 | python-dev | set | nosy:
+ python-dev messages: + msg175380 |
| 2012年11月11日 18:11:53 | pitrou | set | messages: + msg175379 |
| 2012年11月11日 18:07:35 | pitrou | create | |