Issue 11797: 2to3 does not correct "reload" (original) (raw)

Issue11797

process

Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: benjamin.peterson Nosy List: Arfrever, BluePeppers, BreamoreBoy, benjamin.peterson, berker.peksag, eric.araujo, ezio.melotti, georg.brandl, jcea, python-dev, r.david.murray, rhettinger, tebeka, torsten
Priority: high Keywords: easy, patch

Created on 2011-04-07 15:57 by tebeka, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
fix_reload.diff BluePeppers,2011-04-07 19:39 reload fixer for 2to3 review
fix_reload.py BreamoreBoy,2012-11-04 03:56 reload fixer without copyright notice
issue11797.diff berker.peksag,2012-11-23 10:19 review
issue11797_v2.diff berker.peksag,2012-12-06 14:20 review
Messages (17)
msg133223 - (view) Author: Miki Tebeka (tebeka) * Date: 2011-04-07 15:57
The following code is not changed by 2to3:: import os reload(os) reload has moved to the imp module.
msg133224 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2011-04-07 16:15
This should get fixed, but I'm *really* curious about what kind of code actually needs to do this ;-)
msg133249 - (view) Author: Laurie Clark-Michalek (BluePeppers) Date: 2011-04-07 19:39
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).
msg133254 - (view) Author: Miki Tebeka (tebeka) * Date: 2011-04-07 20:39
Raymond: Sometimes I store configuration in Python files and would like to reload the configuration.
msg133258 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2011-04-07 21:01
Miki: That's a really great use case. Thanks.
msg138350 - (view) Author: Torsten Landschoff (torsten) * Date: 2011-06-14 21:26
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.
msg141156 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2011-07-26 12:57
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.
msg141429 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2011-07-30 07:10
I sure didn't have anything to do with that file :)
msg141452 - (view) Author: Laurie Clark-Michalek (BluePeppers) Date: 2011-07-30 20:32
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.
msg174749 - (view) Author: Mark Lawrence (BreamoreBoy) * Date: 2012-11-04 03:56
Please find attached a new file with the copyright notice removed. Would someone like to review it please.
msg174750 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2012-11-04 04:14
FixIntern → FixReload
msg174751 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2012-11-04 04:14
More importantly, tests would be great.
msg176162 - (view) Author: Berker Peksag (berker.peksag) * (Python committer) Date: 2012-11-23 10:19
Here's a patch that adds tests and updates the documentation.
msg176718 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2012-11-30 21:08
Thanks for the patch. Could you try to share could with fix_intern? Maybe by moving some things to fixer_utils.
msg177041 - (view) Author: Berker Peksag (berker.peksag) * (Python committer) Date: 2012-12-06 14:20
> 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.
msg177143 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2012-12-08 03:44
New changeset 3576c0c6f860 by Benjamin Peterson in branch 'default': add fixer for reload() -> imp.reload() (closes #11797)\n\nPatch by Laurie Clark-Michalek and Berker Peksag http://hg.python.org/cpython/rev/3576c0c6f860
msg206884 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2013-12-24 02:44
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?
History
Date User Action Args
2022-04-11 14:57:15 admin set github: 56006
2013-12-24 02:44:06 r.david.murray set nosy: + r.david.murraymessages: +
2012-12-08 03:44:17 python-dev set status: open -> closednosy: + python-devmessages: + resolution: fixedstage: test needed -> resolved
2012-12-06 14:20:16 berker.peksag set files: + issue11797_v2.diffmessages: +
2012-12-03 08:12:05 Arfrever set nosy: + Arfrever
2012-11-30 21:08:13 benjamin.peterson set messages: +
2012-11-23 10:19:08 berker.peksag set files: + issue11797.diffnosy: + berker.peksagmessages: +
2012-11-04 04:14:58 eric.araujo set messages: + stage: patch review -> test needed
2012-11-04 04:14:32 eric.araujo set stage: patch reviewmessages: + versions: + Python 2.7, Python 3.2, Python 3.3, Python 3.4
2012-11-04 03:56:24 BreamoreBoy set files: + fix_reload.pynosy: + BreamoreBoymessages: +
2011-07-30 20:32:17 BluePeppers set messages: +
2011-07-30 07:10:12 georg.brandl set nosy: + georg.brandlmessages: +
2011-07-26 12:57:12 eric.araujo set messages: +
2011-06-14 21:26:29 torsten set nosy: + torstenmessages: +
2011-04-08 15:56:34 eric.araujo set assignee: benjamin.petersonnosy: + benjamin.peterson
2011-04-08 15:56:19 eric.araujo set nosy: + eric.araujo
2011-04-08 02:58:21 jcea set nosy: + jcea
2011-04-07 21🔞29 ezio.melotti set nosy: + ezio.melotti
2011-04-07 21:01:03 rhettinger set priority: normal -> highmessages: +
2011-04-07 20:39:03 tebeka set messages: +
2011-04-07 19:39:55 BluePeppers set files: + fix_reload.diffnosy: + BluePeppersmessages: + keywords: + patch
2011-04-07 16:15:05 rhettinger set nosy: + rhettingermessages: + keywords: + easytype: behavior
2011-04-07 15:57:22 tebeka create