This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Namespace packages have inconsistent __loader__ and __spec__.loader
Type: Stage: resolved
Components: Versions: Python 3.8, Python 3.7, Python 3.6
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: barry Nosy List: barry, eric.smith
Priority: normal Keywords: patch

Created on 2017-12-13 15:41 by barry, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 5481 merged barry, 2018-02-01 20:14
PR 5498 closed miss-islington, 2018-02-02 20:16
PR 5504 merged barry, 2018-02-03 01:04
PR 5911 merged barry, 2018-02-26 18:22
Messages (6)
msg308204 - (view) Author: Barry A. Warsaw (barry) * (Python committer) Date: 2017-12-13 15:41
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 Issue31554
msg311464 - (view) Author: Barry A. Warsaw (barry) * (Python committer) Date: 2018-02-01 20:13
3.5 is in security fix only mode, and this is not a security issue.
msg311511 - (view) Author: Barry A. Warsaw (barry) * (Python committer) Date: 2018-02-02 20:16
New changeset bbbcf8693b876daae4469765aa62f8924f39a7d2 by Barry Warsaw in branch 'master':
bpo-32303 - Consistency fixes for namespace loaders (#5481)
https://github.com/python/cpython/commit/bbbcf8693b876daae4469765aa62f8924f39a7d2
msg311529 - (view) Author: Barry A. Warsaw (barry) * (Python committer) Date: 2018-02-03 00:49
New changeset a23d30f64bd9c5655cfae7f359d4279c47f6cab3 by Barry Warsaw in branch '3.7':
bpo-32303 - Consistency fixes for namespace loaders (GH-5481) (#5503)
https://github.com/python/cpython/commit/a23d30f64bd9c5655cfae7f359d4279c47f6cab3
msg311532 - (view) Author: Barry A. Warsaw (barry) * (Python committer) Date: 2018-02-03 04:21
New changeset a71397fb6603d0fe673acd7765c74699cd28fe7b by Barry Warsaw in branch '3.6':
[3.6] bpo-32303 - Consistency fixes for namespace loaders (GH-5481) (#5504)
https://github.com/python/cpython/commit/a71397fb6603d0fe673acd7765c74699cd28fe7b
msg312945 - (view) Author: Barry A. Warsaw (barry) * (Python committer) Date: 2018-02-26 19:23
New changeset 86ea85134645c75783936ca4b5c6269cb8ac4634 by Barry Warsaw in branch '3.6':
Revert "[3.6] bpo-32303 - Consistency fixes for namespace loaders (GH-5481) (#5504)" (#5911)
https://github.com/python/cpython/commit/86ea85134645c75783936ca4b5c6269cb8ac4634
History
Date User Action Args
2022-04-11 14:58:55adminsetgithub: 76484
2018-02-26 19:23:32barrysetmessages: + msg312945
2018-02-26 18:22:20barrysetpull_requests: + pull_request5681
2018-02-03 04:21:37barrysetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2018-02-03 04:21:17barrysetmessages: + msg311532
2018-02-03 01:04:30barrysetpull_requests: + pull_request5336
2018-02-03 00:49:28barrysetmessages: + msg311529
2018-02-02 20:16:15miss-islingtonsetpull_requests: + pull_request5331
2018-02-02 20:16:00barrysetmessages: + msg311511
2018-02-01 20:14:48barrysetkeywords: + patch
stage: patch review
pull_requests: + pull_request5311
2018-02-01 20:13:59barrysetmessages: + msg311464
versions: - Python 3.5
2018-02-01 15:38:53barrysetassignee: barry
versions: + Python 3.8
2017-12-13 15:57:17eric.smithsetnosy: + eric.smith
2017-12-13 15:41:43barrycreate