From cc7571727f2f5734af4a50940237e98dcb778d96 Mon Sep 17 00:00:00 2001 From: Alexandre Vassalotti Date: Sun, 14 Apr 2013 02:25:10 -0700 Subject: [PATCH] Style cleanups for pickle.py and _pickle. --- Lib/pickle.py | 12 +++++++----- Modules/_pickle.c | 6 ++---- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Lib/pickle.py b/Lib/pickle.py index e81a3790c3d..168865df924 100644 --- a/Lib/pickle.py +++ b/Lib/pickle.py @@ -933,7 +933,7 @@ def load_long4(self): 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 @@ def load_binstring(self): # 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 @@ def load_binstring(self): def load_binbytes(self, unpack=struct.unpack, maxsize=sys.maxsize): len, = unpack(' 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 @@ def load_unicode(self): def load_binunicode(self, unpack=struct.unpack, maxsize=sys.maxsize): len, = unpack(' 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 @@ def get_extension(self, code): 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 diff --git a/Modules/_pickle.c b/Modules/_pickle.c index b4dbe2f307a..146dccca443 100644 --- a/Modules/_pickle.c +++ b/Modules/_pickle.c @@ -4260,8 +4260,7 @@ load_binbytes(UnpicklerObject *self) if (x < 0) { PyErr_Format(PyExc_OverflowError, "BINBYTES exceeds system's maximum size of %zd bytes", - PY_SSIZE_T_MAX - ); + PY_SSIZE_T_MAX); return -1; } @@ -4385,8 +4384,7 @@ load_binunicode(UnpicklerObject *self) if (size < 0) { PyErr_Format(PyExc_OverflowError, "BINUNICODE exceeds system's maximum size of %zd bytes", - PY_SSIZE_T_MAX - ); + PY_SSIZE_T_MAX); return -1; }