mirror of
https://github.com/python/cpython.git
synced 2024-11-23 18:04:37 +08:00
*Semantic change*: when unpickling the instance variables of an
instance, use inst.__dict__.update(value) instead of a for loop with setattr() over the value.keys(). This is more consistent (the pickling doesn't use getattr() either but pickles inst.__dict__) and avoids problems with instances that have a __setattr__ hook. But it *is* a semantic change (because the setattr hook is no longer used). So beware!
This commit is contained in:
parent
75626a3b93
commit
d6ead328b3
@ -843,8 +843,7 @@ class Unpickler:
|
||||
try:
|
||||
setstate = inst.__setstate__
|
||||
except AttributeError:
|
||||
for key in value.keys():
|
||||
setattr(inst, key, value[key])
|
||||
inst.__dict__.update(value)
|
||||
else:
|
||||
setstate(value)
|
||||
dispatch[BUILD] = load_build
|
||||
|
Loading…
Reference in New Issue
Block a user