summaryrefslogtreecommitdiffstats
path: root/Lib/pickle.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1996-04-12 13:36:27 (GMT)
committerGuido van Rossum <guido@python.org>1996-04-12 13:36:27 (GMT)
commit7853647dd16b649c1639a37cb27913a6dfc0631d (patch)
tree85e23d39a068837f6e5a35a96781fcb10563fd60 /Lib/pickle.py
parente7b900d04b6fe8c5e8069d8e87763c5ee78ed300 (diff)
downloadcpython-7853647dd16b649c1639a37cb27913a6dfc0631d.zip
cpython-7853647dd16b649c1639a37cb27913a6dfc0631d.tar.gz
cpython-7853647dd16b649c1639a37cb27913a6dfc0631d.tar.bz2
Don't atoi() the memo key.
Use atoi(), atol(), atof() instead of load_atomic for seed-up.
Diffstat (limited to 'Lib/pickle.py')
-rw-r--r--Lib/pickle.py23
1 files changed, 16 insertions, 7 deletions
diff --git a/Lib/pickle.py b/Lib/pickle.py
index 9ebe03a..f4bd226 100644
--- a/Lib/pickle.py
+++ b/Lib/pickle.py
@@ -388,12 +388,21 @@ class Unpickler:
self.stack.append(None)
dispatch[NONE] = load_none
- def load_atomic(self):
+ def load_int(self):
+ self.stack.append(string.atoi(self.readline()[:-1]))
+ dispatch[INT] = load_int
+
+ def load_long(self):
+ self.stack.append(string.atol(self.readline()[:-1]))
+ dispatch[LONG] = load_long
+
+ def load_float(self):
+ self.stack.append(string.atof(self.readline()[:-1]))
+ dispatch[FLOAT] = load_float
+
+ def load_string(self):
self.stack.append(eval(self.readline()[:-1]))
- dispatch[INT] = load_atomic
- dispatch[LONG] = load_atomic
- dispatch[FLOAT] = load_atomic
- dispatch[STRING] = load_atomic
+ dispatch[STRING] = load_string
def load_tuple(self):
k = self.marker()
@@ -459,11 +468,11 @@ class Unpickler:
dispatch[DUP] = load_dup
def load_get(self):
- self.stack.append(self.memo[string.atoi(self.readline()[:-1])])
+ self.stack.append(self.memo[self.readline()[:-1]])
dispatch[GET] = load_get
def load_put(self):
- self.memo[string.atoi(self.readline()[:-1])] = self.stack[-1]
+ self.memo[self.readline()[:-1]] = self.stack[-1]
dispatch[PUT] = load_put
def load_append(self):