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

Namespace packages have inconsistent __loader__ and __spec__.loader #76484

Closed
warsaw opened this issue Dec 13, 2017 · 6 comments
Closed

Namespace packages have inconsistent __loader__ and __spec__.loader #76484

warsaw opened this issue Dec 13, 2017 · 6 comments
Assignees
Labels
3.7 (EOL) end of life 3.8 only security fixes

Comments

@warsaw
Copy link
Member

warsaw commented Dec 13, 2017

BPO 32303
Nosy @warsaw, @ericvsmith
PRs
  • bpo-32303: Consistency fixes for namespace loaders #5481
  • [3.7] bpo-32303 - Consistency fixes for namespace loaders (GH-5481) #5498
  • [3.6] bpo-32303 - Consistency fixes for namespace loaders (GH-5481) #5504
  • bpo-32872 - Revert "[3.6] bpo-32303 - Consistency fixes for namespace loaders... #5911
  • 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/warsaw'
    closed_at = <Date 2018-02-03.04:21:37.059>
    created_at = <Date 2017-12-13.15:41:43.123>
    labels = ['3.7', '3.8']
    title = 'Namespace packages have inconsistent __loader__ and __spec__.loader'
    updated_at = <Date 2018-02-26.19:23:32.471>
    user = 'https://github.com/warsaw'

    bugs.python.org fields:

    activity = <Date 2018-02-26.19:23:32.471>
    actor = 'barry'
    assignee = 'barry'
    closed = True
    closed_date = <Date 2018-02-03.04:21:37.059>
    closer = 'barry'
    components = []
    creation = <Date 2017-12-13.15:41:43.123>
    creator = 'barry'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 32303
    keywords = ['patch']
    message_count = 6.0
    messages = ['308204', '311464', '311511', '311529', '311532', '312945']
    nosy_count = 2.0
    nosy_names = ['barry', 'eric.smith']
    pr_nums = ['5481', '5498', '5504', '5911']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue32303'
    versions = ['Python 3.6', 'Python 3.7', 'Python 3.8']

    @warsaw
    Copy link
    Member Author

    warsaw commented Dec 13, 2017

    Let's say I have a namespace package:

    >>> importlib_resources.tests.data03.namespace
    <module 'importlib_resources.tests.data03.namespace' (namespace)>

    This package has a non-None __loader__ but a None __spec__.loader:

    >>> importlib_resources.tests.data03.namespace.__loader__
    <_frozen_importlib_external._NamespaceLoader object at 0x1043c1588>
    >>> importlib_resources.tests.data03.namespace.__spec__.loader
    >>> 

    That seems inconsistent and broken. I suspect it's just an oversight that the __spec__.loader for a namespace package isn't getting set. It's probably been this way forever.

    See also bpo-31554

    @warsaw warsaw added the 3.7 (EOL) end of life label Dec 13, 2017
    @warsaw warsaw added the 3.8 only security fixes label Feb 1, 2018
    @warsaw warsaw self-assigned this Feb 1, 2018
    @warsaw
    Copy link
    Member Author

    warsaw commented Feb 1, 2018

    3.5 is in security fix only mode, and this is not a security issue.

    @warsaw
    Copy link
    Member Author

    warsaw commented Feb 2, 2018

    New changeset bbbcf86 by Barry Warsaw in branch 'master':
    bpo-32303 - Consistency fixes for namespace loaders (bpo-5481)
    bbbcf86

    @warsaw
    Copy link
    Member Author

    warsaw commented Feb 3, 2018

    New changeset a23d30f by Barry Warsaw in branch '3.7':
    bpo-32303 - Consistency fixes for namespace loaders (GH-5481) (bpo-5503)
    a23d30f

    @warsaw
    Copy link
    Member Author

    warsaw commented Feb 3, 2018

    New changeset a71397f by Barry Warsaw in branch '3.6':
    [3.6] bpo-32303 - Consistency fixes for namespace loaders (GH-5481) (bpo-5504)
    a71397f

    @warsaw warsaw closed this as completed Feb 3, 2018
    @warsaw
    Copy link
    Member Author

    warsaw commented Feb 26, 2018

    New changeset 86ea851 by Barry Warsaw in branch '3.6':
    Revert "[3.6] bpo-32303 - Consistency fixes for namespace loaders (GH-5481) (bpo-5504)" (bpo-5911)
    86ea851

    @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.7 (EOL) end of life 3.8 only security fixes
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant