]> granicus.if.org Git - python/commitdiff
_slotnames(): exclude __dict__ and __weakref__; these aren't real
authorGuido van Rossum <guido@python.org>
Mon, 3 Feb 2003 18:10:09 +0000 (18:10 +0000)
committerGuido van Rossum <guido@python.org>
Mon, 3 Feb 2003 18:10:09 +0000 (18:10 +0000)
slots even though they can be listed in __slots__.

Lib/pickle.py

index 0d553a70f961a957eff2910ba7d2f7784d97a974..05772b0e2570dc61babf219f13d73bae26f8f12d 100644 (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):