Skip to content

Commit acdc21b

Browse files
bnoordhuistargos
authored andcommitted
tools: make pty_helper.py python3-compatible
Fixes: #29166 PR-URL: #29167 Reviewed-By: Sam Roberts <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Rich Trott <[email protected]>
1 parent 5c5ef4e commit acdc21b

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

test/pseudo-tty/pty_helper.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,12 @@ def pipe(sfd, dfd):
2525
if dfd == STDOUT:
2626
# Work around platform quirks. Some platforms echo ^D as \x04
2727
# (AIX, BSDs) and some don't (Linux).
28-
filt = lambda c: ord(c) > 31 or c in '\t\n\r\f'
28+
#
29+
# The comparison against b' '[0] is because |data| is
30+
# a string in python2 but a bytes object in python3.
31+
filt = lambda c: c >= b' '[0] or c in b'\t\n\r\f'
2932
data = filter(filt, data)
33+
data = bytes(data)
3034

3135
while data:
3236
try:

0 commit comments

Comments
 (0)