Skip to content

Update reload fixer to use importlib instead of imp #65645

Closed

Description

@berkerpeksag
BPO 21446
Nosy @brettcannon, @benjaminp, @berkerpeksag, @JelleZijlstra
PRs
  • bpo-21446: Update reload fixer to use importlib #8391
  • [3.7] bpo-21446: Update reload fixer to use importlib (GH-8391) #8404
  • Files
  • reload-fixer.diff
  • 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 = None
    closed_at = <Date 2018-07-23.08:11:50.550>
    created_at = <Date 2014-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 = <Date 2018-07-23.08:11:50.550>
    user = 'https://github.com/berkerpeksag'

    bugs.python.org fields:

    activity = <Date 2018-07-23.08:11:50.550>
    actor = 'berker.peksag'
    assignee = 'none'
    closed = True
    closed_date = <Date 2018-07-23.08:11:50.550>
    closer = 'berker.peksag'
    components = ['2to3 (2.x to 3.x conversion tool)']
    creation = <Date 2014-05-06.09:51:39.916>
    creator = 'berker.peksag'
    dependencies = []
    files = ['35161']
    hgrepos = []
    issue_num = 21446
    keywords = ['patch']
    message_count = 9.0
    messages = ['217973', '217987', '266951', '321609', '321630', '322133', '322151', '322182', '322186']
    nosy_count = 4.0
    nosy_names = ['brett.cannon', 'benjamin.peterson', 'berker.peksag', 'JelleZijlstra']
    pr_nums = ['8391', '8404']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue21446'
    versions = ['Python 3.7', 'Python 3.8']

    Activity

    1. berkerpeksag commented on May 6, 2014

      @berkerpeksag
      MemberAuthor

      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().

    2. brettcannon commented on May 6, 2014

      @brettcannon
      Member

      I don't think that's necessarily obvious since that will make your code tied to Python 3.4.

    3. JelleZijlstra commented on Jun 2, 2016

      @JelleZijlstra
      Member

      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.

    4. berkerpeksag commented on Jul 13, 2018

      @berkerpeksag
      MemberAuthor

      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'?

    5. brettcannon commented on Jul 13, 2018

      @brettcannon
      Member

      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. :)

    6. berkerpeksag commented on Jul 22, 2018

      @berkerpeksag
      MemberAuthor

      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.

    7. brettcannon commented on Jul 22, 2018

      @brettcannon
      Member

      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:

      Berker Peksag <[email protected]> added the comment:

      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.

      ----------


      Python tracker <[email protected]>
      <https://bugs.python.org/issue21446\>


    8. berkerpeksag commented on Jul 23, 2018

      @berkerpeksag
      MemberAuthor

      New changeset 7a3056f by Berker Peksag in branch 'master':
      bpo-21446: Update reload fixer to use importlib (GH-8391)
      7a3056f

    9. berkerpeksag commented on Jul 23, 2018

      @berkerpeksag
      MemberAuthor

      New changeset 05a72f1 by Berker Peksag (Miss Islington (bot)) in branch '3.7':
      bpo-21446: Update reload fixer to use importlib (GH-8391)
      05a72f1

    10. transferred this issue fromon Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    No one assigned

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions