Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

modulefinder skips nested modules with same name as top-level bad module #79557

Closed
rdb mannequin opened this issue Dec 2, 2018 · 3 comments
Closed

modulefinder skips nested modules with same name as top-level bad module #79557

rdb mannequin opened this issue Dec 2, 2018 · 3 comments
Labels
3.8 only security fixes stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error

Comments

@rdb
Copy link
Mannequin

rdb mannequin commented Dec 2, 2018

BPO 35376
Nosy @ncoghlan, @ericsnowcurrently, @rdb
PRs
  • bpo-35376: Fix modulefinder skipping some nested modules #10895
  • bpo-35936: Updates to modulefinder #11787
  • Files
  • patch.diff: Patch (made against 3.6 branch)
  • 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 2019-04-07.08:06:56.872>
    created_at = <Date 2018-12-02.15:00:55.410>
    labels = ['3.8', 'type-bug', 'library']
    title = 'modulefinder skips nested modules with same name as top-level bad module'
    updated_at = <Date 2019-04-07.08:06:56.871>
    user = 'https://github.com/rdb'

    bugs.python.org fields:

    activity = <Date 2019-04-07.08:06:56.871>
    actor = 'ncoghlan'
    assignee = 'none'
    closed = True
    closed_date = <Date 2019-04-07.08:06:56.872>
    closer = 'ncoghlan'
    components = ['Library (Lib)']
    creation = <Date 2018-12-02.15:00:55.410>
    creator = 'rdb'
    dependencies = []
    files = ['47968']
    hgrepos = []
    issue_num = 35376
    keywords = ['patch']
    message_count = 3.0
    messages = ['330883', '331366', '339563']
    nosy_count = 4.0
    nosy_names = ['jvr', 'ncoghlan', 'eric.snow', 'rdb']
    pr_nums = ['10895', '11787']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue35376'
    versions = ['Python 3.8']

    @rdb
    Copy link
    Mannequin Author

    rdb mannequin commented Dec 2, 2018

    If modulefinder finds a nested module import (eg. 'import a.b.c') while there is a top-level module with the same name (eg. 'c') that failed to import and got added to the badmodules list, it will skip it entirely without even trying to import it.

    This has a trivial fix (attached). The right thing to do is clearly to check it by fqname in the badmodules dict since that's also what it expects in other locations.

    I can make a PR as soon as my CLA gets validated, if that is more convenient. (Which branch should I make the PR against?)

    @rdb rdb mannequin added 3.7 (EOL) end of life 3.8 only security fixes stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error labels Dec 2, 2018
    @brettcannon
    Copy link
    Member

    PRs should always be against 'master' unless the issue is already fixed there.

    @ncoghlan
    Copy link
    Contributor

    ncoghlan commented Apr 7, 2019

    Fixed for Python 3.8 via the patch for bpo-35936. We won't be backporting that patch as it also migrates modulefinder from the deprecated imp API to the supported importlib one, and is hence considered overly intrusive for a bug fix release.

    @ncoghlan ncoghlan removed the 3.7 (EOL) end of life label Apr 7, 2019
    @ncoghlan ncoghlan closed this as completed Apr 7, 2019
    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.8 only security fixes stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants