gh-96349: fix minor performance regression initializing threading.Event (gh-96350)

This commit is contained in:
Daniel Giger 2022-08-30 08:10:02 -04:00 committed by GitHub
parent b17aae8bbd
commit 22ed5233b7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 9 deletions

View file

@ -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):

View file

@ -0,0 +1 @@
Fixed a minor performance regression in :func:`threading.Event.__init__`