summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@redhat.com>2019-08-19 23:47:07 (GMT)
committerGitHub <noreply@github.com>2019-08-19 23:47:07 (GMT)
commitd11c2c607768fa549b1aed7899edc061b2ebf19f (patch)
tree8f639c3614d7d6c1e501797f27d1917160410934
parentd3dcc92778807ae8f7ebe85178f36a29711cd478 (diff)
downloadcpython-d11c2c607768fa549b1aed7899edc061b2ebf19f.zip
cpython-d11c2c607768fa549b1aed7899edc061b2ebf19f.tar.gz
cpython-d11c2c607768fa549b1aed7899edc061b2ebf19f.tar.bz2
Revert "bpo-37788: Fix a reference leak if a thread is not joined (GH-15228)" (GH-15338)
This reverts commit d3dcc92778807ae8f7ebe85178f36a29711cd478.
-rw-r--r--Lib/test/test_threading.py8
-rw-r--r--Lib/threading.py10
-rw-r--r--Misc/NEWS.d/next/Library/2019-08-12-17-21-10.bpo-37788.F0tR05.rst1
3 files changed, 0 insertions, 19 deletions
diff --git a/Lib/test/test_threading.py b/Lib/test/test_threading.py
index 5e90627..7c16974 100644
--- a/Lib/test/test_threading.py
+++ b/Lib/test/test_threading.py
@@ -761,14 +761,6 @@ class ThreadTests(BaseTestCase):
# Daemon threads must never add it to _shutdown_locks.
self.assertNotIn(tstate_lock, threading._shutdown_locks)
- def test_leak_without_join(self):
- # bpo-37788: Test that a thread which is not joined explicitly
- # does not leak. Test written for reference leak checks.
- def noop(): pass
- with support.wait_threads_exit():
- threading.Thread(target=noop).start()
- # Thread.join() is not called
-
class ThreadJoinOnShutdown(BaseTestCase):
diff --git a/Lib/threading.py b/Lib/threading.py
index 67e1c4f..32a3d7c 100644
--- a/Lib/threading.py
+++ b/Lib/threading.py
@@ -806,16 +806,6 @@ class Thread:
# For debugging and _after_fork()
_dangling.add(self)
- def __del__(self):
- if not self._initialized:
- return
- lock = self._tstate_lock
- if lock is not None and not self.daemon:
- # ensure that self._tstate_lock is not in _shutdown_locks
- # if join() was not called explicitly
- with _shutdown_locks_lock:
- _shutdown_locks.discard(lock)
-
def _reset_internal_locks(self, is_alive):
# private! Called by _after_fork() to reset our internal locks as
# they may be in an invalid state leading to a deadlock or crash.
diff --git a/Misc/NEWS.d/next/Library/2019-08-12-17-21-10.bpo-37788.F0tR05.rst b/Misc/NEWS.d/next/Library/2019-08-12-17-21-10.bpo-37788.F0tR05.rst
deleted file mode 100644
index d9b1e82..0000000
--- a/Misc/NEWS.d/next/Library/2019-08-12-17-21-10.bpo-37788.F0tR05.rst
+++ /dev/null
@@ -1 +0,0 @@
-Fix a reference leak if a thread is not joined.