weakref.WeakMethod equality behaves differently than weakref.ref (always False after garbage collection)
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 35/100
Direzione di ricerca
Inizia eseguendo l'esempio fornito di Python REPL e confronta weakref.ref con weakref.WeakMethod prima e dopo la garbage collection. Poi esamina le implementazioni di WeakMethod e ref e i relativi test sull'uguaglianza, se presenti. Il lavoro è completato quando viene stabilita la semantica di uguaglianza prevista dopo l'eliminazione e viene aggiunta una copertura o applicata una correzione mirata se il comportamento è confermato come un bug.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Bug report
Equality comparison of weakref.ref objects succeeds both before and after object deletion. Equality of two weakref.WeakMethod objects, however, is always false if the underlying object has been deleted:
>>> from weakref import WeakMethod, ref
>>> class T:
... def x(self): ...
...
>>> t = T()
>>> r1 = ref(t)
>>> r2 = ref(t)
>>> m1 = WeakMethod(t.x)
>>> m2 = WeakMethod(t.x)
>>> r1 == r2
True
>>> m1 == m2
True
>>> del t
>>> r1 == r2
True
>>> m1 == m2
False
Is this a bug? or perhaps desirable behavior or a fundamental limitation of bound method weak references?
Your environment
- Python 3.11.0 | packaged by conda-forge | (main, Jan 15 2023, 05:44:48) [Clang 14.0.6 ] on darwin
- macos x86_64, v12.6.1 (21G217)
- Lingua principale
- Python
- Stelle
- 77.2k
- Fork
- 36k
- Merge medio
- 1g 9h
- PR unite (30g)
- 558
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di python/cpython
-
docs pending
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
-
stdlib type-feature
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
-
stdlib type-feature
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
-
build type-bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
-
stdlib topic-email type-feature
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
Tutte le issue di python/cpython
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 86/100
-
🐛 Bug 🔔 Pending processing
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
jumpserver/jumpserver#17584 ·