summaryrefslogtreecommitdiffstats
path: root/Lib/pickletools.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/pickletools.py
parente22905a06c0632cb1c5fefcbbb51c0675ae21bba (diff)
downloadcpython-26d95c3d07eb0893c7867d935d61a0fb7be43f2d.zip
cpython-26d95c3d07eb0893c7867d935d61a0fb7be43f2d.tar.gz
cpython-26d95c3d07eb0893c7867d935d61a0fb7be43f2d.tar.bz2
More str/bytes fixes.
Diffstat (limited to 'Lib/pickletools.py')
-rw-r--r--Lib/pickletools.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/Lib/pickletools.py b/Lib/pickletools.py
index f3e8fbc..537afd2 100644
--- a/Lib/pickletools.py
+++ b/Lib/pickletools.py
@@ -291,12 +291,12 @@ def read_stringnl(f, decode=True, stripquotes=True):
"""
data = f.readline()
- if not data.endswith('\n'):
+ if not data.endswith(b'\n'):
raise ValueError("no newline found when trying to read stringnl")
data = data[:-1] # lose the newline
if stripquotes:
- for q in "'\"":
+ for q in (b'"', b"'"):
if data.startswith(q):
if not data.endswith(q):
raise ValueError("strinq quote %r not found at both "
@@ -427,7 +427,7 @@ def read_unicodestringnl(f):
"""
data = f.readline()
- if not data.endswith('\n'):
+ if not data.endswith(b'\n'):
raise ValueError("no newline found when trying to read "
"unicodestringnl")
data = data[:-1] # lose the newline
@@ -497,7 +497,7 @@ def read_decimalnl_short(f):
"""
s = read_stringnl(f, decode=False, stripquotes=False)
- if s.endswith("L"):
+ if s.endswith(b"L"):
raise ValueError("trailing 'L' not allowed in %r" % s)
# It's not necessarily true that the result fits in a Python short int: