diff options
Diffstat (limited to 'Lib/pickle.py')
-rw-r--r-- | Lib/pickle.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/Lib/pickle.py b/Lib/pickle.py index 409d4b2..b94b305 100644 --- a/Lib/pickle.py +++ b/Lib/pickle.py @@ -1195,7 +1195,15 @@ class _Unpickler: if isinstance(state, tuple) and len(state) == 2: state, slotstate = state if state: - inst.__dict__.update(state) + d = inst.__dict__ + intern = sys.intern + try: + for k, v in state.items(): + d[intern(k)] = v + # keys in state don't have to be strings + # don't blow up, but don't go out of our way + except TypeError: + d.update(state) if slotstate: for k, v in slotstate.items(): setattr(inst, k, v) |