This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: 2to3 does not correct "reload"
Type: behavior Stage: resolved
Components: 2to3 (2.x to 3.x conversion tool) Versions: Python 3.2, Python 3.3, Python 3.4, Python 2.7
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.

File name Uploaded Description Edit
fix_reload.diff BluePeppers, 2011-04-07 19:39 reload fixer for 2to3 review 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 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' >, 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 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
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 there anything that should be done here, or do we just use imp.reload even though it is deprecated in 3.4?
Date User Action Args
2022-04-11 14:57:15adminsetgithub: 56006
2013-12-24 02:44:06r.david.murraysetnosy: + r.david.murray
messages: + msg206884
2012-12-08 03:44:17python-devsetstatus: open -> closed

nosy: + python-dev
messages: + msg177143

resolution: fixed
stage: test needed -> resolved
2012-12-06 14:20:16berker.peksagsetfiles: + issue11797_v2.diff

messages: + msg177041
2012-12-03 08:12:05Arfreversetnosy: + Arfrever
2012-11-30 21:08:13benjamin.petersonsetmessages: + msg176718
2012-11-23 10:19:08berker.peksagsetfiles: + issue11797.diff
nosy: + berker.peksag
messages: + msg176162

2012-11-04 04:14:58eric.araujosetmessages: + msg174751
stage: patch review -> test needed
2012-11-04 04:14:32eric.araujosetstage: patch review
messages: + msg174750
versions: + Python 2.7, Python 3.2, Python 3.3, Python 3.4
2012-11-04 03:56:24BreamoreBoysetfiles: +
nosy: + BreamoreBoy
messages: + msg174749

2011-07-30 20:32:17BluePepperssetmessages: + msg141452
2011-07-30 07:10:12georg.brandlsetnosy: + georg.brandl
messages: + msg141429
2011-07-26 12:57:12eric.araujosetmessages: + msg141156
2011-06-14 21:26:29torstensetnosy: + torsten
messages: + msg138350
2011-04-08 15:56:34eric.araujosetassignee: benjamin.peterson

nosy: + benjamin.peterson
2011-04-08 15:56:19eric.araujosetnosy: + eric.araujo
2011-04-08 02:58:21jceasetnosy: + jcea
2011-04-07 21:18:29ezio.melottisetnosy: + ezio.melotti
2011-04-07 21:01:03rhettingersetpriority: normal -> high

messages: + msg133258
2011-04-07 20:39:03tebekasetmessages: + msg133254
2011-04-07 19:39:55BluePepperssetfiles: + fix_reload.diff

nosy: + BluePeppers
messages: + msg133249

keywords: + patch
2011-04-07 16:15:05rhettingersetnosy: + rhettinger
messages: + msg133224

keywords: + easy
type: behavior
2011-04-07 15:57:22tebekacreate