mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
gh-94619: Remove long deprecated methods module_repr() and load_module() (#94624)
* gh-94619: Remove long deprecated methods module_repr() and load_module() Closes #94619 * Update Misc/NEWS.d/next/Library/2022-07-06-14-57-33.gh-issue-94619.PRqKVX.rst Fix typo Co-authored-by: Brett Cannon <brett@python.org> Co-authored-by: Brett Cannon <brett@python.org>
This commit is contained in:
parent
44f1f63ad5
commit
e1182bc377
12 changed files with 11 additions and 180 deletions
|
@ -296,11 +296,6 @@ def _module_repr(module):
|
|||
loader = getattr(module, '__loader__', None)
|
||||
if spec := getattr(module, "__spec__", None):
|
||||
return _module_repr_from_spec(spec)
|
||||
elif hasattr(loader, 'module_repr'):
|
||||
try:
|
||||
return loader.module_repr(module)
|
||||
except Exception:
|
||||
pass
|
||||
# Fall through to a catch-all which always succeeds.
|
||||
try:
|
||||
name = module.__name__
|
||||
|
@ -582,7 +577,6 @@ def module_from_spec(spec):
|
|||
|
||||
def _module_repr_from_spec(spec):
|
||||
"""Return the repr to use for the module."""
|
||||
# We mostly replicate _module_repr() using the spec attributes.
|
||||
name = '?' if spec.name is None else spec.name
|
||||
if spec.origin is None:
|
||||
if spec.loader is None:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue