summaryrefslogtreecommitdiff
path: root/Lib/pickle.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/pickle.py')
-rw-r--r--Lib/pickle.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/Lib/pickle.py b/Lib/pickle.py
index abed1ca4fa..8c5d51fc15 100644
--- a/Lib/pickle.py
+++ b/Lib/pickle.py
@@ -1221,7 +1221,15 @@ class Unpickler:
state, slotstate = state
if state:
try:
- inst.__dict__.update(state)
+ d = inst.__dict__
+ try:
+ for k, v in state.iteritems():
+ 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)
+
except RuntimeError:
# XXX In restricted execution, the instance's __dict__
# is not accessible. Use the old way of unpickling