Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit da3f228

Browse files
committed
Convert various string literals to bytes.
1 parent c4140a1 commit da3f228

3 files changed

Lines changed: 6 additions & 6 deletions

File tree

Lib/binhex.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class Error(Exception):
3838
# Various constants
3939
REASONABLY_LARGE = 32768 # Minimal amount we pass the rle-coder
4040
LINELEN = 64
41-
RUNCHAR = chr(0x90) # run-length introducer
41+
RUNCHAR = b"\x90"
4242

4343
#
4444
# This code is no longer byte-order dependent
@@ -351,11 +351,11 @@ def _fill(self, wtd):
351351
# otherwise: keep 1 byte.
352352
#
353353
mark = len(self.pre_buffer)
354-
if self.pre_buffer[-3:] == RUNCHAR + '\0' + RUNCHAR:
354+
if self.pre_buffer[-3:] == RUNCHAR + b'\0' + RUNCHAR:
355355
mark = mark - 3
356356
elif self.pre_buffer[-1] == RUNCHAR:
357357
mark = mark - 2
358-
elif self.pre_buffer[-2:] == RUNCHAR + '\0':
358+
elif self.pre_buffer[-2:] == RUNCHAR + b'\0':
359359
mark = mark - 2
360360
elif self.pre_buffer[-2] == RUNCHAR:
361361
pass # Decode all

Lib/test/test_httplib.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,13 @@ class NoEOFStringIO(io.BytesIO):
3131
"""
3232
def read(self, n=-1):
3333
data = io.BytesIO.read(self, n)
34-
if data == '':
34+
if data == b'':
3535
raise AssertionError('caller tried to read past EOF')
3636
return data
3737

3838
def readline(self, length=None):
3939
data = io.BytesIO.readline(self, length)
40-
if data == '':
40+
if data == b'':
4141
raise AssertionError('caller tried to read past EOF')
4242
return data
4343

Lib/wave.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ class Error(Exception):
8484

8585
# Determine endian-ness
8686
import struct
87-
if struct.pack("h", 1) == "\000\001":
87+
if struct.pack("h", 1) == b"\000\001":
8888
big_endian = 1
8989
else:
9090
big_endian = 0

0 commit comments

Comments
 (0)