summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_threading.py
diff options
context:
space:
mode:
authoruniocto <serit142sa33go@gmail.com>2021-05-18 08:56:52 (GMT)
committerGitHub <noreply@github.com>2021-05-18 08:56:52 (GMT)
commit115dea9e2602b96b63390f00cc880e90c433efa2 (patch)
tree3d3af7b2991b4954221a607cbf17b69db2eef927 /Lib/test/test_threading.py
parent834498e178684a7e2da49b4efe1adea33e0026b0 (diff)
downloadcpython-115dea9e2602b96b63390f00cc880e90c433efa2.zip
cpython-115dea9e2602b96b63390f00cc880e90c433efa2.tar.gz
cpython-115dea9e2602b96b63390f00cc880e90c433efa2.tar.bz2
bpo-25872: Add unit tests for linecache and threading (GH-25913)
Diffstat (limited to 'Lib/test/test_threading.py')
-rw-r--r--Lib/test/test_threading.py19
1 files changed, 18 insertions, 1 deletions
diff --git a/Lib/test/test_threading.py b/Lib/test/test_threading.py
index 08c0ccd..b563797 100644
--- a/Lib/test/test_threading.py
+++ b/Lib/test/test_threading.py
@@ -4,7 +4,7 @@ Tests for the threading module.
import test.support
from test.support import threading_helper
-from test.support import verbose, cpython_only
+from test.support import verbose, cpython_only, os_helper
from test.support.import_helper import import_module
from test.support.script_helper import assert_python_ok, assert_python_failure
@@ -19,6 +19,7 @@ import os
import subprocess
import signal
import textwrap
+import traceback
from unittest import mock
from test import lock_tests
@@ -1345,6 +1346,22 @@ class ThreadingExceptionTests(BaseTestCase):
# explicitly break the reference cycle to not leak a dangling thread
thread.exc = None
+ def test_multithread_modify_file_noerror(self):
+ # See issue25872
+ def modify_file():
+ with open(os_helper.TESTFN, 'w', encoding='utf-8') as fp:
+ fp.write(' ')
+ traceback.format_stack()
+
+ self.addCleanup(os_helper.unlink, os_helper.TESTFN)
+ threads = [
+ threading.Thread(target=modify_file)
+ for i in range(100)
+ ]
+ for t in threads:
+ t.start()
+ t.join()
+
class ThreadRunFail(threading.Thread):
def run(self):