Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork33.3k
Closed
Description
Feature or enhancement
AfterLoader.module_repr has been deprecated, the repr of namespace is like:
<module 'xx' (<_frozen_bootstrap_external.NamespaceLoader object at 0x0000000>)>
which is unreadable. So I purpose the following repr:
<module 'xx' (namespace) from ['path1', 'path2']>
The change purposed to code is:
def_module_repr_from_spec(spec):"""Return the repr to use for the module."""name='?'ifspec.nameisNoneelsespec.nameifspec.originisNone:ifspec.loaderisNone:returnf'<module{name!r}>'else:returnf'<module{name!r} (namespace) from{list(spec.loader._path)}>'<<<thislinechangedreturnf'<module{name!r} ({spec.loader!r})>'>>>theunmodifiedlineelse:ifspec.has_location:returnf'<module{name!r} from{spec.origin!r}>'else:returnf'<module{spec.name!r} ({spec.origin})>'
In my interpreter test:
>>> import a>>> a<module 'a' (namespace) from ['/home/iyume/workspace/cpython/a']>If OK, I can open PR, and add test code.