Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 15982aa

Browse filesBrowse files
committed
reinitialize an Event's Condition with a regular lock (closes #25319)
1 parent 601953b commit 15982aa
Copy full SHA for 15982aa

File tree

Expand file treeCollapse file tree

4 files changed

+13
-1
lines changed
Filter options
Expand file treeCollapse file tree

4 files changed

+13
-1
lines changed

‎Lib/test/lock_tests.py

Copy file name to clipboardExpand all lines: Lib/test/lock_tests.py
+8Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -388,6 +388,14 @@ def f():
388388
b.wait_for_finished()
389389
self.assertEqual(results, [True] * N)
390390

391+
def test_reset_internal_locks(self):
392+
evt = self.eventtype()
393+
old_lock = evt._cond._lock
394+
evt._reset_internal_locks()
395+
new_lock = evt._cond._lock
396+
self.assertIsNot(new_lock, old_lock)
397+
self.assertIs(type(new_lock), type(old_lock))
398+
391399

392400
class ConditionTests(BaseTestCase):
393401
"""

‎Lib/threading.py

Copy file name to clipboardExpand all lines: Lib/threading.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -496,7 +496,7 @@ def __init__(self):
496496

497497
def _reset_internal_locks(self):
498498
# private! called by Thread._reset_internal_locks by _after_fork()
499-
self._cond.__init__()
499+
self._cond.__init__(Lock())
500500

501501
def is_set(self):
502502
"""Return true if and only if the internal flag is true."""

‎Misc/ACKS

Copy file name to clipboardExpand all lines: Misc/ACKS
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1315,6 +1315,7 @@ Ryan Smith-Roberts
13151315
Rafal Smotrzyk
13161316
Eric Snow
13171317
Dirk Soede
1318+
Nir Soffer
13181319
Paul Sokolovsky
13191320
Evgeny Sologubov
13201321
Cody Somerville

‎Misc/NEWS

Copy file name to clipboardExpand all lines: Misc/NEWS
+3Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,9 @@ Library
100100
submit a coroutine to a loop from another thread, returning a
101101
concurrent.futures.Future. By Vincent Michel.
102102

103+
- Issue #25319: When threading.Event is reinitialized, the underlying condition
104+
should use a regular lock rather than a recursive lock.
105+
103106
- Issue #25232: Fix CGIRequestHandler to split the query from the URL at the
104107
first question mark (?) rather than the last. Patch from Xiang Zhang.
105108

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.