mirror of
https://github.com/python/cpython.git
synced 2025-10-09 16:34:44 +00:00
bpo-42136: Deprecate module_repr() as found in importlib (GH-25022)
This commit is contained in:
parent
21a2cabb37
commit
1899087b21
11 changed files with 1545 additions and 1478 deletions
|
@ -302,8 +302,6 @@ def _module_repr(module):
|
|||
except Exception:
|
||||
pass
|
||||
# Fall through to a catch-all which always succeeds.
|
||||
# We could use module.__class__.__name__ instead of 'module' in the
|
||||
# various repr permutations.
|
||||
try:
|
||||
name = module.__name__
|
||||
except AttributeError:
|
||||
|
@ -741,6 +739,8 @@ class BuiltinImporter:
|
|||
The method is deprecated. The import machinery does the job itself.
|
||||
|
||||
"""
|
||||
_warnings.warn("BuiltinImporter.module_repr() is deprecated and "
|
||||
"slated for removal in Python 3.12", DeprecationWarning)
|
||||
return f'<module {module.__name__!r} ({BuiltinImporter._ORIGIN})>'
|
||||
|
||||
@classmethod
|
||||
|
@ -816,6 +816,8 @@ class FrozenImporter:
|
|||
The method is deprecated. The import machinery does the job itself.
|
||||
|
||||
"""
|
||||
_warnings.warn("FrozenImporter.module_repr() is deprecated and "
|
||||
"slated for removal in Python 3.12", DeprecationWarning)
|
||||
return '<module {!r} ({})>'.format(m.__name__, FrozenImporter._ORIGIN)
|
||||
|
||||
@classmethod
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue