summaryrefslogtreecommitdiffstats
path: root/Lib/pickle.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1996-05-15 22:49:57 (GMT)
committerGuido van Rossum <guido@python.org>1996-05-15 22:49:57 (GMT)
commit955c5d156d8a6c2f0109bc1c8fabc5008a41376c (patch)
tree0e10af7d71f5c8f5dffd78f77fe3b632d822e833 /Lib/pickle.py
parent6dabc984005c02c0289a17d8d173dc800214b44f (diff)
downloadcpython-955c5d156d8a6c2f0109bc1c8fabc5008a41376c.zip
cpython-955c5d156d8a6c2f0109bc1c8fabc5008a41376c.tar.gz
cpython-955c5d156d8a6c2f0109bc1c8fabc5008a41376c.tar.bz2
Set the base for atoi() and atol() to 0, since we're reading Python
numbers here, and so that atol() doesn't barf on the trailing 'L'. Add a test case involving a long integer.
Diffstat (limited to 'Lib/pickle.py')
-rw-r--r--Lib/pickle.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/Lib/pickle.py b/Lib/pickle.py
index f4bd226..8f5da40 100644
--- a/Lib/pickle.py
+++ b/Lib/pickle.py
@@ -389,11 +389,11 @@ class Unpickler:
dispatch[NONE] = load_none
def load_int(self):
- self.stack.append(string.atoi(self.readline()[:-1]))
+ self.stack.append(string.atoi(self.readline()[:-1], 0))
dispatch[INT] = load_int
def load_long(self):
- self.stack.append(string.atol(self.readline()[:-1]))
+ self.stack.append(string.atol(self.readline()[:-1], 0))
dispatch[LONG] = load_long
def load_float(self):
@@ -544,7 +544,7 @@ def test():
fn = 'pickle_tmp'
c = C()
c.foo = 1
- c.bar = 2
+ c.bar = 2L
x = [0,1,2,3]
y = ('abc', 'abc', c, c)
x.append(y)