mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
Fix a scoping issue where an UnboundLocalError was triggered if a
lazy-loaded module was already in sys.modules.
This commit is contained in:
parent
559ad5d401
commit
e92dc9c23d
3 changed files with 18 additions and 4 deletions
|
@ -241,7 +241,7 @@ class _LazyModule(types.ModuleType):
|
|||
if id(self) != id(sys.modules[original_name]):
|
||||
msg = ('module object for {!r} substituted in sys.modules '
|
||||
'during a lazy load')
|
||||
raise ValueError(msg.format(original_name))
|
||||
raise ValueError(msg.format(original_name))
|
||||
# Update after loading since that's what would happen in an eager
|
||||
# loading situation.
|
||||
self.__dict__.update(attrs_updated)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue