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_fcntl.py b/Lib/test/test_fcntl.py
index e8eeaaa..6c64b82 100644
--- a/Lib/test/test_fcntl.py
+++ b/Lib/test/test_fcntl.py
@@ -62,7 +62,7 @@
def test_fcntl_fileno(self):
# the example from the library docs
- self.f = open(TESTFN, 'w')
+ self.f = open(TESTFN, 'wb')
rv = fcntl.fcntl(self.f.fileno(), fcntl.F_SETFL, os.O_NONBLOCK)
if verbose:
print('Status from fcntl with O_NONBLOCK: ', rv)
@@ -74,7 +74,7 @@
def test_fcntl_file_descriptor(self):
# again, but pass the file rather than numeric descriptor
- self.f = open(TESTFN, 'w')
+ self.f = open(TESTFN, 'wb')
rv = fcntl.fcntl(self.f, fcntl.F_SETFL, os.O_NONBLOCK)
if sys.platform not in ['os2emx']:
rv = fcntl.fcntl(self.f, fcntl.F_SETLKW, lockdata)