diff options
author | Daniel Giger <danielg1111@verizon.net> | 2022-08-30 12:10:02 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-30 12:10:02 (GMT) |
commit | 22ed5233b76fe33f9767c6a5665608e7f398e7d7 (patch) | |
tree | 677d5048b2ea8857446b413e972b4cf7087eb120 /Lib | |
parent | b17aae8bbd13bec28b7ecbb5a147503f2e9cf365 (diff) | |
download | cpython-22ed5233b76fe33f9767c6a5665608e7f398e7d7.zip cpython-22ed5233b76fe33f9767c6a5665608e7f398e7d7.tar.gz cpython-22ed5233b76fe33f9767c6a5665608e7f398e7d7.tar.bz2 |
gh-96349: fix minor performance regression initializing threading.Event (gh-96350)
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/threading.py | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/Lib/threading.py b/Lib/threading.py index 7237a14..d030e12 100644 --- a/Lib/threading.py +++ b/Lib/threading.py @@ -262,18 +262,12 @@ class Condition: # 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): |