You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Update reload fixer to use importlib instead of imp #65645
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:
assignee=Noneclosed_at=<Date2018-07-23.08:11:50.550>created_at=<Date2014-05-06.09:51:39.916>labels= ['3.7', '3.8', 'type-feature', 'expert-2to3']
title='Update reload fixer to use importlib instead of imp'updated_at=<Date2018-07-23.08:11:50.550>user='https://github.com/berkerpeksag'
Since imp.reload() was deprecated in bpo-18193, the reload fixer (added in bpo-11797) needs to be updated to use importlib.reload() instead of imp.reload().
I couldn't find references in the docs to clarify what version of 3.x 2to3 targets, but it seems reasonable to me that it produces code targeted to the version of CPython it was bundled with. imp is deprecated and presumably will be removed later in 3.x, so it's better not to migrate people's Python 2 code to use it.
I would still fix it as I suspect there will be a burst of users of this come 2020 and at this point it won't be a compatibility issue going forward since 3.4 is so old. :)
Thanks, Brett. I've opened PR 8391. Should we backport this to 3.7? We do backport mimetypes additions (see 8204b90 for an example) I think lib2to3 falls into the same category as mimetypes and it might be better to keep fixers in sync at least in 3.7 and 3.8.
Thanks, Brett. I've opened PR 8391. Should we backport this to 3.7? We do
backport mimetypes additions (see 8204b90
for an example) I think lib2to3 falls into the same category as mimetypes
and it might be better to keep fixers in sync at least in 3.7 and 3.8.
Activity
berkerpeksag commentedon May 6, 2014
Since imp.reload() was deprecated in bpo-18193, the reload fixer (added in bpo-11797) needs to be updated to use importlib.reload() instead of imp.reload().
brettcannon commentedon May 6, 2014
I don't think that's necessarily obvious since that will make your code tied to Python 3.4.
JelleZijlstra commentedon Jun 2, 2016
I couldn't find references in the docs to clarify what version of 3.x 2to3 targets, but it seems reasonable to me that it produces code targeted to the version of CPython it was bundled with. imp is deprecated and presumably will be removed later in 3.x, so it's better not to migrate people's Python 2 code to use it.
berkerpeksag commentedon Jul 13, 2018
Brett, what do you think about this issue since Python 3.4 is pretty old now. Should I convert my patch to GitHub PR or close this issue as 'wontfix'?
brettcannon commentedon Jul 13, 2018
I would still fix it as I suspect there will be a burst of users of this come 2020 and at this point it won't be a compatibility issue going forward since 3.4 is so old. :)
berkerpeksag commentedon Jul 22, 2018
Thanks, Brett. I've opened PR 8391. Should we backport this to 3.7? We do backport mimetypes additions (see 8204b90 for an example) I think lib2to3 falls into the same category as mimetypes and it might be better to keep fixers in sync at least in 3.7 and 3.8.
brettcannon commentedon Jul 22, 2018
I think we said backporting fixers was fine but I honestly don't remember.
On Sat, Jul 21, 2018, 23:22 Berker Peksag, <[email protected]> wrote:
berkerpeksag commentedon Jul 23, 2018
New changeset 7a3056f by Berker Peksag in branch 'master':
bpo-21446: Update reload fixer to use importlib (GH-8391)
7a3056f
berkerpeksag commentedon Jul 23, 2018
New changeset 05a72f1 by Berker Peksag (Miss Islington (bot)) in branch '3.7':
bpo-21446: Update reload fixer to use importlib (GH-8391)
05a72f1