summaryrefslogtreecommitdiffstats
path: root/Lib/pickle.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2007-08-27 23:18:54 (GMT)
committerGuido van Rossum <guido@python.org>2007-08-27 23:18:54 (GMT)
commit26d95c3d07eb0893c7867d935d61a0fb7be43f2d (patch)
tree6c8e091b96da7f5a0fe8ce373598f5b3f1c346a6 /Lib/pickle.py
parente22905a06c0632cb1c5fefcbbb51c0675ae21bba (diff)
downloadcpython-26d95c3d07eb0893c7867d935d61a0fb7be43f2d.zip
cpython-26d95c3d07eb0893c7867d935d61a0fb7be43f2d.tar.gz
cpython-26d95c3d07eb0893c7867d935d61a0fb7be43f2d.tar.bz2
More str/bytes fixes.
Diffstat (limited to 'Lib/pickle.py')
-rw-r--r--Lib/pickle.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/Lib/pickle.py b/Lib/pickle.py
index 9127f14..f01c428 100644
--- a/Lib/pickle.py
+++ b/Lib/pickle.py
@@ -843,7 +843,7 @@ class Unpickler:
def load_proto(self):
proto = ord(self.read(1))
if not 0 <= proto <= 2:
- raise ValueError, "unsupported pickle protocol: %d" % proto
+ raise ValueError("unsupported pickle protocol: %d" % proto)
dispatch[PROTO[0]] = load_proto
def load_persid(self):
@@ -920,14 +920,14 @@ class Unpickler:
def load_string(self):
rep = self.readline()[:-1]
- for q in "\"'": # double or single quote
+ for q in (b'"', b"'"): # double or single quote
if rep.startswith(q):
if not rep.endswith(q):
- raise ValueError, "insecure string pickle"
+ raise ValueError("insecure string pickle")
rep = rep[len(q):-len(q)]
break
else:
- raise ValueError, "insecure string pickle"
+ raise ValueError("insecure string pickle")
self.append(str(codecs.escape_decode(rep)[0], "latin-1"))
dispatch[STRING[0]] = load_string
@@ -1014,8 +1014,8 @@ class Unpickler:
try:
value = klass(*args)
except TypeError as err:
- raise TypeError, "in constructor for %s: %s" % (
- klass.__name__, str(err)), sys.exc_info()[2]
+ raise TypeError("in constructor for %s: %s" %
+ (klass.__name__, str(err)), sys.exc_info()[2])
self.append(value)
def load_inst(self):