New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
importlib.reload() does not return the module in sys.modules #62898
Comments
Currently reload() returns the module that loader.load_module() returns, rather than returning the one in sys.modules. This is different from what happens during normal import. I would expect reload() to return what's in sys.modules. Perhaps this got overlooked when we moved reload()? I haven't had a chance to verify, but I do recall that the switch to importlib-based import in 3.3 exposed a bug where importlib wasn't returning the module in sys.modules during normal import. |
I'm sure it's an oversight. |
Yep. In 2.7 and 3.2 the PyImport_ExecCodeModuleEx() function in Python/importlib.c returns the module found in sys.modules. Here is a patch. I suppose this should be fixed in 2.7 as well. Thoughts? |
I think you mean in 3.3 and yes. =) Patch LGTM so I say fix in 3.3 and merge into default. |
New changeset e22e7268e58a by Eric Snow in branch '3.3': New changeset 1af087712e69 by Eric Snow in branch 'default': |
oops. That commit message for 3.3 should have read "imp.reload()". :) |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: