summaryrefslogtreecommitdiffstats
path: root/Lib/pickle.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2000-12-13 18:11:56 (GMT)
committerGuido van Rossum <guido@python.org>2000-12-13 18:11:56 (GMT)
commitff87174db1b10f7d630c079481d9ac67f4cb8d5c (patch)
treee3540c2c26697fdf23dadd6079050f76e847a79a /Lib/pickle.py
parentbc9c1b15ccd2f9c4a0e6789527d5ad85a8aa7308 (diff)
downloadcpython-ff87174db1b10f7d630c079481d9ac67f4cb8d5c.zip
cpython-ff87174db1b10f7d630c079481d9ac67f4cb8d5c.tar.gz
cpython-ff87174db1b10f7d630c079481d9ac67f4cb8d5c.tar.bz2
Get rid of string module and string exceptions.
Diffstat (limited to 'Lib/pickle.py')
-rw-r--r--Lib/pickle.py17
1 files changed, 10 insertions, 7 deletions
diff --git a/Lib/pickle.py b/Lib/pickle.py
index 128a627..c26c2e5 100644
--- a/Lib/pickle.py
+++ b/Lib/pickle.py
@@ -27,7 +27,6 @@ __version__ = "$Revision$" # Code version
from types import *
from copy_reg import dispatch_table, safe_constructors
-import string
import marshal
import sys
import struct
@@ -42,6 +41,10 @@ class PickleError(Exception): pass
class PicklingError(PickleError): pass
class UnpicklingError(PickleError): pass
+class _Stop(Exception):
+ def __init__(self, value):
+ self.value = value
+
try:
from org.python.core import PyStringMap
except ImportError:
@@ -514,8 +517,8 @@ class Unpickler:
while 1:
key = read(1)
dispatch[key](self)
- except STOP, value:
- return value
+ except _Stop, stopinst:
+ return stopinst.value
def marker(self):
stack = self.stack
@@ -549,7 +552,7 @@ class Unpickler:
dispatch[NONE] = load_none
def load_int(self):
- self.append(string.atoi(self.readline()[:-1]))
+ self.append(int(self.readline()[:-1]))
dispatch[INT] = load_int
def load_binint(self):
@@ -565,11 +568,11 @@ class Unpickler:
dispatch[BININT2] = load_binint2
def load_long(self):
- self.append(string.atol(self.readline()[:-1], 0))
+ self.append(long(self.readline()[:-1], 0))
dispatch[LONG] = load_long
def load_float(self):
- self.append(string.atof(self.readline()[:-1]))
+ self.append(float(self.readline()[:-1]))
dispatch[FLOAT] = load_float
def load_binfloat(self, unpack=struct.unpack):
@@ -872,7 +875,7 @@ class Unpickler:
def load_stop(self):
value = self.stack[-1]
del self.stack[-1]
- raise STOP, value
+ raise _Stop(value)
dispatch[STOP] = load_stop
# Helper class for load_inst/load_obj