(merge 3.2) 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.
This commit is contained in:
Victor Stinner 2011-06-30 18:21:39 +02:00
commit 2f655b73e4
5 changed files with 16 additions and 18 deletions

View file

@ -650,11 +650,10 @@ class ThreadJoinOnShutdown(BaseTestCase):
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()