Issue #12451: Open files in binary mode in some tests when the text file is not
needed.
Remove also an unused variable (blank) in test_threading.
diff --git a/Lib/test/test_threading.py b/Lib/test/test_threading.py
index 416d95f..703f80e 100644
--- a/Lib/test/test_threading.py
+++ b/Lib/test/test_threading.py
@@ -642,11 +642,10 @@
def random_io():
'''Loop for a while sleeping random tiny amounts and doing some I/O.'''
- blank = b'x' * 200
while True:
- in_f = open(os.__file__, 'r')
+ in_f = open(os.__file__, 'rb')
stuff = in_f.read(200)
- null_f = open(os.devnull, 'w')
+ null_f = open(os.devnull, 'wb')
null_f.write(stuff)
time.sleep(random.random() / 1995)
null_f.close()