Skip to content

Commit

Permalink
gh-96349: fix minor performance regression initializing threading.Eve…
Browse files Browse the repository at this point in the history
…nt (gh-96350)
  • Loading branch information
dgiger42 authored Aug 30, 2022
1 parent b17aae8 commit 22ed523
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
12 changes: 3 additions & 9 deletions Lib/threading.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,18 +262,12 @@ def __init__(self, lock=None):
# If the lock defines _release_save() and/or _acquire_restore(),
# these override the default implementations (which just call
# release() and acquire() on the lock). Ditto for _is_owned().
try:
if hasattr(lock, '_release_save'):
self._release_save = lock._release_save
except AttributeError:
pass
try:
if hasattr(lock, '_acquire_restore'):
self._acquire_restore = lock._acquire_restore
except AttributeError:
pass
try:
if hasattr(lock, '_is_owned'):
self._is_owned = lock._is_owned
except AttributeError:
pass
self._waiters = _deque()

def _at_fork_reinit(self):
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fixed a minor performance regression in :func:`threading.Event.__init__`

0 comments on commit 22ed523

Please sign in to comment.