tests: in filterpyflakes, tolerate non-ascii file contents
authorArseniy Alekseyev <aalekseyev@janestreet.com>
Fri, 10 Mar 2023 11:20:18 +0000
changeset 50452 e07dc1e7a454
parent 50451 584ff1f97201
child 50453 7f0f3b274d1e
tests: in filterpyflakes, tolerate non-ascii file contents
tests/filterpyflakes.py
--- a/tests/filterpyflakes.py	Mon Jan 30 13:37:48 2023 +0000
+++ b/tests/filterpyflakes.py	Fri Mar 10 11:20:18 2023 +0000
@@ -24,10 +24,9 @@
             break  # pattern matches
     if keep:
         fn = line.split(':', 1)[0]
-        f = open(fn)
-        data = f.read()
-        f.close()
-        if 'no-' 'check-code' in data:
+        with open(fn, 'rb') as f:
+            data = f.read()
+        if b'no-' b'check-code' in data:
             continue
         lines.append(line)