Skip to content

2to3: imports fixer doesn't update references to modules specified without attributes #55485

Closed

Description

@Arfrever
mannequin
BPO 11276
Nosy @vsajip, @jaraco, @benjaminp, @merwok, @PCManticore
Superseder
  • bpo-45544: Close 2to3 issues and list them here
  • 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 2021-10-20.22:45:46.130>
    created_at = <Date 2011-02-21.20:32:50.016>
    labels = ['type-bug', 'expert-2to3']
    title = "2to3: imports fixer doesn't update references to modules specified without attributes"
    updated_at = <Date 2021-10-20.22:45:46.130>
    user = 'https://bugs.python.org/Arfrever'

    bugs.python.org fields:

    activity = <Date 2021-10-20.22:45:46.130>
    actor = 'iritkatriel'
    assignee = 'none'
    closed = True
    closed_date = <Date 2021-10-20.22:45:46.130>
    closer = 'iritkatriel'
    components = ['2to3 (2.x to 3.x conversion tool)']
    creation = <Date 2011-02-21.20:32:50.016>
    creator = 'Arfrever'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 11276
    keywords = []
    message_count = 7.0
    messages = ['128991', '129109', '129236', '130915', '131032', '131042', '133924']
    nosy_count = 6.0
    nosy_names = ['vinay.sajip', 'jaraco', 'benjamin.peterson', 'eric.araujo', 'Arfrever', 'Claudiu.Popa']
    pr_nums = []
    priority = 'normal'
    resolution = 'wont fix'
    stage = 'resolved'
    status = 'closed'
    superseder = '45544'
    type = 'behavior'
    url = 'https://bugs.python.org/issue11276'
    versions = ['Python 3.5']

    Activity

    1. Arfrever commented on Feb 21, 2011

      Arfrevermannequin
      MannequinAuthor
      $ cat test.py
      import cPickle
      cPickle
      cPickle.load
      $ 2to3 -f imports test.py
      RefactoringTool: Refactored test.py
      --- test.py     (original)
      +++ test.py     (refactored)
      @@ -1,3 +1,3 @@
      -import cPickle
      +import pickle
       cPickle
      -cPickle.load
      +pickle.load
      RefactoringTool: Files that need to be modified:
      RefactoringTool: test.py
    2. brettcannon commented on Feb 22, 2011

      @brettcannon
      Member

      While directly referencing a module on its own is useless, this is an issue if the module is used in e.g., an assignment: blah = cPickle is not changed.

    3. benjaminp commented on Feb 24, 2011

      @benjaminp
      Contributor

      I'm trying to remember if this was intentional or not...

    4. jaraco commented on Mar 14, 2011

      @jaraco
      Member

      This bug affects distutils2. See bpo-11502.

    5. jaraco commented on Mar 15, 2011

      @jaraco
      Member

      This bug also affects poster. http://bitbucket.org/jaraco/poster (httplib reference in httpstreaming.py)

    6. jaraco commented on Mar 15, 2011

      @jaraco
      Member

      it looks like lib maintainers can work around the limitation by using the syntax:

       import _winreg as winreg

      And then reference the name winreg (or any other preferred name).

    7. vsajip commented on Apr 17, 2011

      @vsajip
      Member

      Another example: when processing

      if hasattr(httplib, 'ssl'):
          pass

      It doesn't spot that httplib should be changed to http.client.

    8. 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

      Labels

      topic-2to3type-bugAn unexpected behavior, bug, or error

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions