Skip to content

Commit 759de2b

Browse files
committed
refactor test_multithread_modify_file_noerror()
1 parent a977922 commit 759de2b

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

Lib/test/test_threading.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1338,7 +1338,7 @@ def run(self):
13381338
# explicitly break the reference cycle to not leak a dangling thread
13391339
thread.exc = None
13401340

1341-
def test_multithread_modify_file(self):
1341+
def test_multithread_modify_file_noerror(self):
13421342
import traceback
13431343
def modify_file():
13441344
with open(__file__, 'a') as fp:
@@ -1349,8 +1349,13 @@ def modify_file():
13491349
threading.Thread(target=modify_file)
13501350
for i in range(100)
13511351
]
1352-
[t.start() for t in threads]
1353-
[t.join() for t in threads]
1352+
try:
1353+
for t in threads:
1354+
t.start()
1355+
for t in threads:
1356+
t.join()
1357+
finally:
1358+
pass
13541359

13551360

13561361
class ThreadRunFail(threading.Thread):

0 commit comments

Comments
 (0)