8000 Revert "bpo-37788: Fix a reference leak if a thread is not joined" by vstinner · Pull Request #15338 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

Revert "bpo-37788: Fix a reference leak if a thread is not joined" #15338

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 19, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions Lib/test/test_threading.py
Original file line number Diff line number Diff line change
Expand Up @@ -761,14 +761,6 @@ def test_shutdown_locks(self):
# 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):

Expand Down
10 changes: 0 additions & 10 deletions Lib/threading.py
Original file line number Diff line number Diff line change
Expand Up @@ -806,16 +806,6 @@ class is implemented.
# 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.
Expand Down

This file was deleted.

0