summaryrefslogtreecommitdiff
path: root/Lib/pickletools.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2007-08-27 23:18:54 +0000
committerGuido van Rossum <guido@python.org>2007-08-27 23:18:54 +0000
commit7a6258f7d8b38239b4f724441ec26f7430230aa9 (patch)
tree38fb53a30c198d1c5d365600f4e1b87d2eb008d8 /Lib/pickletools.py
parente55d1f3b4aa24db27daa242b2d0bc31f9e3e43e6 (diff)
downloadcpython-7a6258f7d8b38239b4f724441ec26f7430230aa9.tar.gz
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 f3e8fbce0a..537afd26a6 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: