mirror of
https://github.com/python/cpython.git
synced 2025-07-08 03:45:36 +00:00
bpo-35673: Add a public alias for namespace package __loader__ attribute (#29049)
Rename namespace package __loader__ class to be public. Make the old name, i.e. _NamespaceLoader, an alias for the public name, for backward compatibility.
This commit is contained in:
parent
6270d3eeaf
commit
876fc7fcec
7 changed files with 42 additions and 6 deletions
|
@ -507,9 +507,9 @@ def _init_module_attrs(spec, module, *, override=False):
|
|||
if spec.submodule_search_locations is not None:
|
||||
if _bootstrap_external is None:
|
||||
raise NotImplementedError
|
||||
_NamespaceLoader = _bootstrap_external._NamespaceLoader
|
||||
NamespaceLoader = _bootstrap_external.NamespaceLoader
|
||||
|
||||
loader = _NamespaceLoader.__new__(_NamespaceLoader)
|
||||
loader = NamespaceLoader.__new__(NamespaceLoader)
|
||||
loader._path = spec.submodule_search_locations
|
||||
spec.loader = loader
|
||||
# While the docs say that module.__file__ is not set for
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue