[New-bugs-announce] [issue35181] Doc: Namespace Packages: Inconsistent documentation of __loader__ being None

Julien Palard report at bugs.python.org
Tue Nov 6 17:29:09 EST 2018


New submission from Julien Palard <julien+python at palard.fr>:

The documentation states that a __loader__ of a namespace package should be None:

- [1] "For namespace packages this should be set to None."
- [2] "To indicate to the import machinery that the spec represents a namespace portion. the path entry finder sets “loader” on the spec to None".

But this looks wrong [3], looks like it has been changed in [4]/[5].

I think one should rely on __file__ being None on namespace packages (which make sense as they span over multiple directories) instead of __loader__ being None (a side effect of the import machinery ?).


[1]: https://docs.python.org/3/library/importlib.html#importlib.machinery.ModuleSpec.loader
[2]: https://docs.python.org/3/reference/import.html#path-entry-finder-protocol
[3]: https://stackoverflow.com/questions/52869541/namespace-package-spec-loader-and-loader-attributes-not-set-to-none
[4]: https://bugs.python.org/issue32303
[5]: https://github.com/python/cpython/pull/5481/files#diff-a6592cec2ebc8dba9bbf7d396370b138L319

----------
assignee: docs at python
components: Documentation
messages: 329392
nosy: docs at python, mdk
priority: normal
severity: normal
status: open
title: Doc: Namespace Packages: Inconsistent documentation of __loader__ being None
versions: Python 3.7

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


More information about the New-bugs-announce mailing list