]> granicus.if.org Git - python/commitdiff
This is the third time I check in this change :-(
authorGuido van Rossum <guido@python.org>
Thu, 8 Aug 1996 20:26:45 +0000 (20:26 +0000)
committerGuido van Rossum <guido@python.org>
Thu, 8 Aug 1996 20:26:45 +0000 (20:26 +0000)
Don't use assignments into inst.__dict__ to restore instance
variables; use setattr() instead.

Lib/pickle.py

index a481fc7fce9262bb1ccd911db0dd3c11ff90940a..682440d3aeed7b87d5f4e0e34b3aeabc5522cdfa 100644 (file)
@@ -522,9 +522,8 @@ class Unpickler:
                try:
                        setstate = inst.__setstate__
                except AttributeError:
-                       instdict = inst.__dict__
                        for key in value.keys():
-                               instdict[key] = value[key]
+                               setattr(inst, key, value[key])
                else:
                        setstate(value)
        dispatch[BUILD] = load_build