From 08b23082a4c96acaa3e7be066ed736367bc924d8 Mon Sep 17 00:00:00 2001 From: Ben Noordhuis Date: Fri, 16 Aug 2019 20:53:32 +0200 Subject: [PATCH] tools: make pty_helper.py python3-compatible Fixes: https://github.com/nodejs/node/issues/29166 --- test/pseudo-tty/pty_helper.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/test/pseudo-tty/pty_helper.py b/test/pseudo-tty/pty_helper.py index bf62e3f205e66a..a61ef1cc0eda0b 100644 --- a/test/pseudo-tty/pty_helper.py +++ b/test/pseudo-tty/pty_helper.py @@ -25,8 +25,12 @@ def pipe(sfd, dfd): if dfd == STDOUT: # Work around platform quirks. Some platforms echo ^D as \x04 # (AIX, BSDs) and some don't (Linux). - filt = lambda c: ord(c) > 31 or c in '\t\n\r\f' + # + # The comparison against b' '[0] is because |data| is + # a string in python2 but a bytes object in python3. + filt = lambda c: c >= b' '[0] or c in b'\t\n\r\f' data = filter(filt, data) + data = bytes(data) while data: try: