summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2020-03-24 15:32:26 (GMT)
committerGitHub <noreply@github.com>2020-03-24 15:32:26 (GMT)
commit5804f878e779712e803be927ca8a6df389d82cdf (patch)
tree393bdef0f05d253739d2a0335391541cb482fc26 /Lib
parent472fc843ca816d65c12f9508ac762ca492165c45 (diff)
downloadcpython-5804f878e779712e803be927ca8a6df389d82cdf.zip
cpython-5804f878e779712e803be927ca8a6df389d82cdf.tar.gz
cpython-5804f878e779712e803be927ca8a6df389d82cdf.tar.bz2
bpo-20526: Fix PyThreadState_Clear(): don't decref frame (GH-19120)
PyThreadState.frame is a borrowed reference, not a strong reference: PyThreadState_Clear() must not call Py_CLEAR(tstate->frame). Remove test_threading.test_warnings_at_exit(): we cannot warranty that the Python thread state of daemon threads is cleared in a reliable way during Python shutdown.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_threading.py28
1 files changed, 0 insertions, 28 deletions
diff --git a/Lib/test/test_threading.py b/Lib/test/test_threading.py
index 87c68df..f1037b5 100644
--- a/Lib/test/test_threading.py
+++ b/Lib/test/test_threading.py
@@ -776,34 +776,6 @@ class ThreadTests(BaseTestCase):
""")
self.assertEqual(out.rstrip(), b"thread_dict.atexit = 'value'")
- def test_warnings_at_exit(self):
- # bpo-19466: try to call most destructors at Python shutdown before
- # destroying Python thread states
- filename = __file__
- rc, out, err = assert_python_ok("-Wd", "-c", """if 1:
- import time
- import threading
- from test import support
-
- def open_sleep():
- # a warning will be emitted when the open file will be
- # destroyed (without being explicitly closed) while the daemon
- # thread is destroyed
- fileobj = open(%a, 'rb')
- start_event.set()
- time.sleep(support.LONG_TIMEOUT)
-
- start_event = threading.Event()
-
- thread = threading.Thread(target=open_sleep, daemon=True)
- thread.start()
-
- # wait until the thread started
- start_event.wait()
- """ % filename)
- self.assertRegex(err.rstrip(),
- b"^sys:1: ResourceWarning: unclosed file ")
-
class ThreadJoinOnShutdown(BaseTestCase):