]> granicus.if.org Git - python/commitdiff
Set the base for atoi() and atol() to 0, since we're reading Python
authorGuido van Rossum <guido@python.org>
Wed, 15 May 1996 22:49:57 +0000 (22:49 +0000)
committerGuido van Rossum <guido@python.org>
Wed, 15 May 1996 22:49:57 +0000 (22:49 +0000)
numbers here, and so that atol() doesn't barf on the trailing 'L'.
Add a test case involving a long integer.

Lib/pickle.py

index f4bd226c015dcedeecab8ddad76db48fa339698f..8f5da40af1c51bb7894a9af0bb2195252a62753a 100644 (file)
@@ -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)