New submission from Julien Palard <julien+pyt...@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@python
components: Documentation
messages: 329392
nosy: docs@python, mdk
priority: normal
severity: normal
status: open
title: Doc: Namespace Packages: Inconsistent documentation of __loader__ being 
None
versions: Python 3.7

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue35181>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to