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

Raise ImportWarning when falling back to find_module() #86300

Closed
brettcannon opened this issue Oct 23, 2020 · 5 comments
Closed

Raise ImportWarning when falling back to find_module() #86300

brettcannon opened this issue Oct 23, 2020 · 5 comments
Assignees
Labels
3.10 interpreter-core

Comments

@brettcannon
Copy link
Member

@brettcannon brettcannon commented Oct 23, 2020

BPO 42134
Nosy @brettcannon, @vstinner, @hroncok
PRs
  • #25044
  • 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 = 'https://github.com/brettcannon'
    closed_at = <Date 2021-03-30.19:08:43.309>
    created_at = <Date 2020-10-23.23:10:10.032>
    labels = ['interpreter-core', '3.10']
    title = 'Raise ImportWarning when falling back to find_module()'
    updated_at = <Date 2021-04-08.21:31:25.417>
    user = 'https://github.com/brettcannon'

    bugs.python.org fields:

    activity = <Date 2021-04-08.21:31:25.417>
    actor = 'brett.cannon'
    assignee = 'brett.cannon'
    closed = True
    closed_date = <Date 2021-03-30.19:08:43.309>
    closer = 'brett.cannon'
    components = ['Interpreter Core']
    creation = <Date 2020-10-23.23:10:10.032>
    creator = 'brett.cannon'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 42134
    keywords = ['patch']
    message_count = 5.0
    messages = ['379492', '389833', '390511', '390513', '390554']
    nosy_count = 3.0
    nosy_names = ['brett.cannon', 'vstinner', 'hroncok']
    pr_nums = ['25044']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue42134'
    versions = ['Python 3.10']

    @brettcannon
    Copy link
    Member Author

    @brettcannon brettcannon commented Oct 23, 2020

    find_spec() has superseded find_module() since Python 3.4.

    @brettcannon brettcannon added 3.10 interpreter-core labels Oct 23, 2020
    @brettcannon
    Copy link
    Member Author

    @brettcannon brettcannon commented Mar 30, 2021

    New changeset a7ff6df by Brett Cannon in branch 'master':
    bpo-42134: Raise ImportWarning when calling find_module() in the import system (GH-25044)
    a7ff6df

    @hroncok
    Copy link
    Mannequin

    @hroncok hroncok mannequin commented Apr 8, 2021

    Brett, would you accept a PR that changes the changelog entry to contain the ".find_spec() not found; falling back to find_module()" message, for better search-ability? I needed to use grep + git blame to be able to find out what's going on.

    Also, could you please explain how to migrate to find_spec() in https://docs.python.org/3.10/whatsnew/3.10.html#porting-to-python-3-10 ? I'd do that, but I don't know yet what is the proper way.

    @vstinner
    Copy link
    Member

    @vstinner vstinner commented Apr 8, 2021

    See also bpo-43540 "importlib: Document how to replace load_module() in What's New in Python 3.10".

    @brettcannon
    Copy link
    Member Author

    @brettcannon brettcannon commented Apr 8, 2021

    would you accept a PR that changes the changelog entry to contain the ".find_spec() not found; falling back to find_module()" message, for better search-ability?

    Sure!

    Also, could you please explain how to migrate to find_spec() in https://docs.python.org/3.10/whatsnew/3.10.html#porting-to-python-3-10 ? I'd do that, but I don't know yet what is the proper way.

    The problem is it will possibly vary from class to class. You can probably get pretty far with https://docs.python.org/3/library/importlib.html#importlib.util.spec_from_file_location or https://docs.python.org/3/library/importlib.html#importlib.util.spec_from_loader depending.

    @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.10 interpreter-core
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants