-
-
Notifications
You must be signed in to change notification settings - Fork 31.9k
bpo-44422: threading.Thread reuses the _delete() method #26741
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
Conversation
The _bootstrap_inner() method of threading.Thread now reuses its _delete() method rather than accessing _active() directly. It became possible since _active_limbo_lock became reentrant. Moreover, it no longer ignores any exception when deleting the thread from the _active dictionary.
History:
|
This is https://bugs.python.org/issue1703448 The fix adds test_enumerate_after_join() to Lib/test/test_threading.py which still exists. Running test_threading should be enough to check for non-regression.
|
cc @iritkatriel |
How did you conclude that the try-except is no longer needed? |
I don't understand in which case an exception can occur. In case of doubt, I prefer to remove it. We can add the try/except KeyError again if someone hits the issue. https://bugs.python.org/issue497111 was reported 20 years ago. The Python code base changed a lot in 20 years. For example, I modified the Python finalization to clear daemon threads earlier: commit 9ad58ac. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense.
@iritkatriel: Thanks for the review. I merged my PR. |
The _bootstrap_inner() method of threading.Thread now reuses its _delete() method rather than accessing _active() directly. It became possible since _active_limbo_lock became reentrant. Moreover, it no longer ignores any exception when deleting the thread from the _active dictionary.
The _bootstrap_inner() method of threading.Thread now reuses its
_delete() method rather than accessing _active() directly. It became
possible since _active_limbo_lock became reentrant. Moreover, it no
longer ignores any exception when deleting the thread from the
_active dictionary.
https://bugs.python.org/issue44422