[New-bugs-announce] [issue32303] Namespace packages have inconsistent __loader__ and __spec__.loader

Barry A. Warsaw report at bugs.python.org
Wed Dec 13 10:41:43 EST 2017


New submission from Barry A. Warsaw <barry at python.org>:

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

----------
messages: 308204
nosy: barry
priority: normal
severity: normal
status: open
title: Namespace packages have inconsistent __loader__ and __spec__.loader
versions: Python 3.5, Python 3.6, Python 3.7

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue32303>
_______________________________________


More information about the New-bugs-announce mailing list