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
2to3 does not correct "reload" #56006
Comments
The following code is not changed by 2to3::
reload has moved to the imp module. |
This should get fixed, but I'm *really* curious about what kind of code actually needs to do this ;-) |
Find a fixer for this attached. I really just did sed 's/intern/reload' fix_intern.py >fix_reload.py, but it seems to work. I didn't write any tests (I couldn't seem to find any for any other fixers). |
Raymond: Sometimes I store configuration in Python files and would like to reload the configuration. |
Miki: That's a really great use case. Thanks. |
The other use case I see is to reload a module during debugging after changing the code. This is especially useful for big GUI applications. |
File looks good, although I’m not sure about the “Copyright 2006 Georg Brandl” line. I also don’t know if stable branches can get this fix. |
I sure didn't have anything to do with that file :) |
Ah, that's my fault. As I mentioned, I simply replaced sys with imp and intern with reload from fix_intern.py. Seeing as the vast majority of the file was not modified, I didn't bother to change the copyright notices. |
Please find attached a new file with the copyright notice removed. Would someone like to review it please. |
FixIntern → FixReload |
More importantly, tests would be great. |
Here's a patch that adds tests and updates the documentation. |
Thanks for the patch. Could you try to share could with fix_intern? Maybe by moving some things to fixer_utils. |
Thanks for the suggestion. Here's a new patch. I'm not sure the name of the helper is correct. |
New changeset 3576c0c6f860 by Benjamin Peterson in branch 'default': |
Since this patch was applied, imp.reload has been deprecated in favor of importlib.reload. I don't know how we handle differences between python3 versions...is there anything that should be done here, or do we just use imp.reload even though it is deprecated in 3.4? |
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: