Skip to content

Commit ba62b83

Browse files
committed
change __file__ and rm traceback.format_stack
1 parent bcc20ab commit ba62b83

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

Lib/test/test_threading.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
import test.support
66
from test.support import threading_helper
7-
from test.support import verbose, cpython_only
7+
from test.support import verbose, cpython_only, os_helper
88
from test.support.import_helper import import_module
99
from test.support.script_helper import assert_python_ok, assert_python_failure
1010

@@ -19,7 +19,6 @@
1919
import subprocess
2020
import signal
2121
import textwrap
22-
import traceback
2322

2423
from unittest import mock
2524
from test import lock_tests
@@ -1342,9 +1341,9 @@ def run(self):
13421341
def test_multithread_modify_file_noerror(self):
13431342
# See issue25872
13441343
def modify_file():
1345-
with open(__file__, 'a') as fp:
1344+
with open(os_helper.TESTFN, 'w', encoding='utf-8') as fp:
13461345
fp.write(' ')
1347-
traceback.format_stack()
1346+
self.addCleanup(os_helper.unlink, os_helper.TESTFN)
13481347

13491348
threads = [
13501349
threading.Thread(target=modify_file)

0 commit comments

Comments
 (0)