_slotnames(): exclude __dict__ and __weakref__; these aren't real

slots even though they can be listed in __slots__.
This commit is contained in:
Guido van Rossum 2003-02-03 18:10:09 +00:00
parent 795ea89cb5
commit 868ecc22ab
1 changed files with 2 additions and 1 deletions

View File

@ -881,7 +881,8 @@ def _slotnames(cls):
names = []
for c in cls.__mro__:
if "__slots__" in c.__dict__:
names += list(c.__dict__["__slots__"])
names += [name for name in c.__dict__["__slots__"]
if name not in ("__dict__", "__weakref__")]
return names
def _keep_alive(x, memo):