From da3f228740772a63ae41f3306a510eb6971dcd54 Mon Sep 17 00:00:00 2001 From: Jeremy Hylton Date: Wed, 29 Aug 2007 17:26:34 +0000 Subject: Convert various string literals to bytes. --- Lib/binhex.py | 6 +++--- Lib/test/test_httplib.py | 4 ++-- Lib/wave.py | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Lib/binhex.py b/Lib/binhex.py index 4c53315..e4d551f 100644 --- a/Lib/binhex.py +++ b/Lib/binhex.py @@ -38,7 +38,7 @@ class Error(Exception): # Various constants REASONABLY_LARGE = 32768 # Minimal amount we pass the rle-coder LINELEN = 64 -RUNCHAR = chr(0x90) # run-length introducer +RUNCHAR = b"\x90" # # This code is no longer byte-order dependent @@ -351,11 +351,11 @@ class _Rledecoderengine: # otherwise: keep 1 byte. # mark = len(self.pre_buffer) - if self.pre_buffer[-3:] == RUNCHAR + '\0' + RUNCHAR: + if self.pre_buffer[-3:] == RUNCHAR + b'\0' + RUNCHAR: mark = mark - 3 elif self.pre_buffer[-1] == RUNCHAR: mark = mark - 2 - elif self.pre_buffer[-2:] == RUNCHAR + '\0': + elif self.pre_buffer[-2:] == RUNCHAR + b'\0': mark = mark - 2 elif self.pre_buffer[-2] == RUNCHAR: pass # Decode all diff --git a/Lib/test/test_httplib.py b/Lib/test/test_httplib.py index d9b3b82..bbcdd8b 100644 --- a/Lib/test/test_httplib.py +++ b/Lib/test/test_httplib.py @@ -31,13 +31,13 @@ class NoEOFStringIO(io.BytesIO): """ def read(self, n=-1): data = io.BytesIO.read(self, n) - if data == '': + if data == b'': raise AssertionError('caller tried to read past EOF') return data def readline(self, length=None): data = io.BytesIO.readline(self, length) - if data == '': + if data == b'': raise AssertionError('caller tried to read past EOF') return data diff --git a/Lib/wave.py b/Lib/wave.py index 6627bcf..42bf8bf 100644 --- a/Lib/wave.py +++ b/Lib/wave.py @@ -84,7 +84,7 @@ _array_fmts = None, 'b', 'h', None, 'l' # Determine endian-ness import struct -if struct.pack("h", 1) == "\000\001": +if struct.pack("h", 1) == b"\000\001": big_endian = 1 else: big_endian = 0 -- cgit v0.12