From 9c27118c20cf63de7637092955e5e41de7aa3316 Mon Sep 17 00:00:00 2001 From: Ben Noordhuis Date: Fri, 16 Aug 2019 20:53:32 +0200 Subject: tools: make pty_helper.py python3-compatible Fixes: https://github.com/nodejs/node/issues/29166 PR-URL: https://github.com/nodejs/node/pull/29167 Reviewed-By: Sam Roberts Reviewed-By: Anna Henningsen Reviewed-By: Rich Trott --- 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 bf62e3f205..a61ef1cc0e 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: -- cgit v1.2.3