summaryrefslogtreecommitdiffstats
path: root/Lib/pickle.py
diff options
context:
space:
mode:
authorAlexandre Vassalotti <alexandre@peadrop.com>2013-04-14 09:25:10 (GMT)
committerAlexandre Vassalotti <alexandre@peadrop.com>2013-04-14 09:25:10 (GMT)
commitcc7571727f2f5734af4a50940237e98dcb778d96 (patch)
tree437d1891e31fd35903cd958e7ced8728dfddc6b9 /Lib/pickle.py
parentf36f20f850c10e8828ada85507680eb6529ef920 (diff)
downloadcpython-cc7571727f2f5734af4a50940237e98dcb778d96.zip
cpython-cc7571727f2f5734af4a50940237e98dcb778d96.tar.gz
cpython-cc7571727f2f5734af4a50940237e98dcb778d96.tar.bz2
Style cleanups for pickle.py and _pickle.
Diffstat (limited to 'Lib/pickle.py')
-rw-r--r--Lib/pickle.py12
1 files changed, 7 insertions, 5 deletions
diff --git a/Lib/pickle.py b/Lib/pickle.py
index e81a379..168865d 100644
--- a/Lib/pickle.py
+++ b/Lib/pickle.py
@@ -933,7 +933,7 @@ class _Unpickler:
n = mloads(b'i' + self.read(4))
if n < 0:
# Corrupt or hostile pickle -- we never write one like this
- raise UnpicklingError("LONG pickle has negative byte count");
+ raise UnpicklingError("LONG pickle has negative byte count")
data = self.read(n)
self.append(decode_long(data))
dispatch[LONG4[0]] = load_long4
@@ -965,7 +965,7 @@ class _Unpickler:
# Deprecated BINSTRING uses signed 32-bit length
len = mloads(b'i' + self.read(4))
if len < 0:
- raise UnpicklingError("BINSTRING pickle has negative byte count");
+ raise UnpicklingError("BINSTRING pickle has negative byte count")
data = self.read(len)
value = str(data, self.encoding, self.errors)
self.append(value)
@@ -974,7 +974,8 @@ class _Unpickler:
def load_binbytes(self, unpack=struct.unpack, maxsize=sys.maxsize):
len, = unpack('<I', self.read(4))
if len > maxsize:
- raise UnpicklingError("BINBYTES exceeds system's maximum size of %d bytes" % maxsize);
+ raise UnpicklingError("BINBYTES exceeds system's maximum size "
+ "of %d bytes" % maxsize)
self.append(self.read(len))
dispatch[BINBYTES[0]] = load_binbytes
@@ -985,7 +986,8 @@ class _Unpickler:
def load_binunicode(self, unpack=struct.unpack, maxsize=sys.maxsize):
len, = unpack('<I', self.read(4))
if len > maxsize:
- raise UnpicklingError("BINUNICODE exceeds system's maximum size of %d bytes" % maxsize);
+ raise UnpicklingError("BINUNICODE exceeds system's maximum size "
+ "of %d bytes" % maxsize)
self.append(str(self.read(len), 'utf-8', 'surrogatepass'))
dispatch[BINUNICODE[0]] = load_binunicode
@@ -1118,7 +1120,7 @@ class _Unpickler:
if not key:
if code <= 0: # note that 0 is forbidden
# Corrupt or hostile pickle.
- raise UnpicklingError("EXT specifies code <= 0");
+ raise UnpicklingError("EXT specifies code <= 0")
raise ValueError("unregistered extension code %d" % code)
obj = self.find_class(*key)
_extension_cache[code] = obj