New submission from Alexander Neumann <alen...@gmail.com>:
The documentation currently states: > Proxy objects are not hashable regardless of the referent; this avoids a > number of problems related to their fundamentally mutable nature, and prevent > their use as dictionary keys. callback is the same as the parameter of the > same name to the ref() function. However, it seems with commit 96074de573f82fc66a2bd73c36905141a3f1d5c1 (https://github.com/python/cpython/commit/96074de573f82fc66a2bd73c36905141a3f1d5c1) hash/reversed pass throughs have been introduced that enable weakref.proxy to be used as a dictionary key. At least the following code fails with Python 3.8 but works with Python 3.9: ``` import weakref class Model: pass m = Model() proxy = weakref.proxy(m) ref = weakref.ref(m) print(hash(m)) print(hash(ref)) print(hash(proxy)) ``` ---------- assignee: docs@python components: Documentation messages: 396637 nosy: aleneum, docs@python priority: normal severity: normal status: open title: weakref.proxy documentation might be outdated type: behavior versions: Python 3.10, Python 3.11, Python 3.9 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue44523> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com