summaryrefslogtreecommitdiff
path: root/Lib/importlib/util.py
diff options
context:
space:
mode:
authorEric Snow <ericsnowcurrently@gmail.com>2014-01-06 20:49:04 -0700
committerEric Snow <ericsnowcurrently@gmail.com>2014-01-06 20:49:04 -0700
commit1500d49c22e1a38d186f2dddfa6ba2c5a6cd7d5e (patch)
treeee32b3fd82c294c8bf257949a22481121d8ef246 /Lib/importlib/util.py
parent02b9f9d6bb596d437ac10d71afac8a4781d18d86 (diff)
downloadcpython-git-1500d49c22e1a38d186f2dddfa6ba2c5a6cd7d5e.tar.gz
Issue 19713: Add PEP 451-related deprecations.
Diffstat (limited to 'Lib/importlib/util.py')
-rw-r--r--Lib/importlib/util.py20
1 files changed, 15 insertions, 5 deletions
diff --git a/Lib/importlib/util.py b/Lib/importlib/util.py
index 04b19515fd..42fc9eae93 100644
--- a/Lib/importlib/util.py
+++ b/Lib/importlib/util.py
@@ -55,11 +55,16 @@ def _module_to_load(name):
module.__initializing__ = False
-# XXX deprecate
def set_package(fxn):
- """Set __package__ on the returned module."""
+ """Set __package__ on the returned module.
+
+ This function is deprecated.
+
+ """
@functools.wraps(fxn)
def set_package_wrapper(*args, **kwargs):
+ warnings.warn('The import system now takes care of this automatically.',
+ DeprecationWarning, stacklevel=2)
module = fxn(*args, **kwargs)
if getattr(module, '__package__', None) is None:
module.__package__ = module.__name__
@@ -69,11 +74,16 @@ def set_package(fxn):
return set_package_wrapper
-# XXX deprecate
def set_loader(fxn):
- """Set __loader__ on the returned module."""
+ """Set __loader__ on the returned module.
+
+ This function is deprecated.
+
+ """
@functools.wraps(fxn)
def set_loader_wrapper(self, *args, **kwargs):
+ warnings.warn('The import system now takes care of this automatically.',
+ DeprecationWarning, stacklevel=2)
module = fxn(self, *args, **kwargs)
if getattr(module, '__loader__', None) is None:
module.__loader__ = self
@@ -100,7 +110,7 @@ def module_for_loader(fxn):
"""
warnings.warn('The import system now takes care of this automatically.',
- PendingDeprecationWarning, stacklevel=2)
+ DeprecationWarning, stacklevel=2)
@functools.wraps(fxn)
def module_for_loader_wrapper(self, fullname, *args, **kwargs):
with _module_to_load(fullname) as module: