bpo-43720: Update import-related stdlib deprecation messages to say they will be removed in Python 3.12 (GH-25167)

This commit is contained in:
Brett Cannon 2021-04-03 15:31:15 -07:00 committed by GitHub
parent c5354c045c
commit dc6d3e1e4c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 16 additions and 7 deletions

View file

@ -149,7 +149,8 @@ def set_package(fxn):
"""
@functools.wraps(fxn)
def set_package_wrapper(*args, **kwargs):
warnings.warn('The import system now takes care of this automatically.',
warnings.warn('The import system now takes care of this automatically; '
'this decorator is slated for removal in Python 3.12',
DeprecationWarning, stacklevel=2)
module = fxn(*args, **kwargs)
if getattr(module, '__package__', None) is None:
@ -168,7 +169,8 @@ def set_loader(fxn):
"""
@functools.wraps(fxn)
def set_loader_wrapper(self, *args, **kwargs):
warnings.warn('The import system now takes care of this automatically.',
warnings.warn('The import system now takes care of this automatically; '
'this decorator is slated for removal in Python 3.12',
DeprecationWarning, stacklevel=2)
module = fxn(self, *args, **kwargs)
if getattr(module, '__loader__', None) is None:
@ -195,7 +197,8 @@ def module_for_loader(fxn):
the second argument.
"""
warnings.warn('The import system now takes care of this automatically.',
warnings.warn('The import system now takes care of this automatically; '
'this decorator is slated for removal in Python 3.12',
DeprecationWarning, stacklevel=2)
@functools.wraps(fxn)
def module_for_loader_wrapper(self, fullname, *args, **kwargs):