[New-bugs-announce] [issue38761] weakref.WeakSet not instanceof collections.abc.Set
Nils Kattenbeck
report at bugs.python.org
Sun Nov 10 06:39:15 EST 2019
New submission from Nils Kattenbeck <nilskemail at gmail.com>:
Instances of weakref.WeakSet are not instances of Set and therefore not of MutableSet but they are instances of Collection.
They however implement all required methods for a MutableSet and Weak(Key|Value)Dictionary are correctly identified.
Is this just an oversight or am I missing something?
from weakref import WeakKeyDictionary, WeakValueDictionary, WeakSet
from collections.abc import MutableMapping, Collection, Set, MutableSet
wkdict = WeakKeyDictionary()
wvdict = WeakValueDictionary()
ws = WeakSet()
assert isinstance(wkdict, MutableMapping)
assert isinstance(wvdict, MutableMapping)
assert isinstance(ws, Collection)
assert not isinstance(ws, Set)
assert not isinstance(ws, MutableSet)
----------
components: Library (Lib)
messages: 356326
nosy: Nils Kattenbeck
priority: normal
severity: normal
status: open
title: weakref.WeakSet not instanceof collections.abc.Set
versions: Python 3.7
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue38761>
_______________________________________
More information about the New-bugs-announce
mailing list