8000 Make is_loading a bool instead of Event · python/cpython@40383a0 · GitHub
[go: up one dir, main page]

Skip to content

Commit 40383a0

Browse files
committed
Make is_loading a bool instead of Event
1 parent 57fe084 commit 40383a0

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Lib/importlib/util.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -183,9 +183,9 @@ def __getattribute__(self, attr):
183183
# exec_module(), which will access module.__dict__, module.__name__,
184184
# and/or module.__spec__, reentering this method. These accesses
185185
# need to be all 9592 owed to proceed without triggering the load again.
186-
if loader_state['is_loading'].is_set() and attr.startswith('__') and attr.endswith('__'):
186+
if loader_state['is_loading'] and attr.startswith('__') and attr.endswith('__'):
187187
return object.__getattribute__(self, attr)
188-
loader_state['is_loading'].set()
188+
loader_state['is_loading'] = True
189189

190190
__dict__ = object.__getattribute__(self, '__dict__')
191191

@@ -264,6 +264,6 @@ def exec_module(self, module):
264264
loader_state['__dict__'] = module.__dict__.copy()
265265
loader_state['__class__'] = module.__class__
266266
loader_state['lock'] = threading.RLock()
267-
loader_state['is_loading'] = threading.Event()
267+
loader_state['is_loading'] = False
268268
module.__spec__.loader_state = loader_state
269269
module.__class__ = _LazyModule

0 commit comments

Comments
 (0)
0