[Python-checkins] cpython: Upgrade the imp module's deprecation to DeprecationWarning.

brett.cannon python-checkins at python.org
Fri Oct 16 15:22:00 EDT 2015


https://hg.python.org/cpython/rev/5877c191b76e
changeset:   98770:5877c191b76e
user:        Brett Cannon <brett at python.org>
date:        Fri Oct 16 12:21:37 2015 -0700
summary:
  Upgrade the imp module's deprecation to DeprecationWarning.

files:
  Doc/whatsnew/3.6.rst |  3 +++
  Lib/imp.py           |  2 +-
  Lib/pkgutil.py       |  2 +-
  Misc/NEWS            |  2 ++
  4 files changed, 7 insertions(+), 2 deletions(-)


diff --git a/Doc/whatsnew/3.6.rst b/Doc/whatsnew/3.6.rst
--- a/Doc/whatsnew/3.6.rst
+++ b/Doc/whatsnew/3.6.rst
@@ -228,6 +228,9 @@
   now raises :exc:`ValueError` for out-of-range values, rather than
   returning :const:`None`.  See :issue:`20059`.
 
+* The :mod:`imp` module now raises a :exc:`DeprecationWarning` instead of
+  :exc:`PendingDeprecationWarning`.
+
 
 Changes in the C API
 --------------------
diff --git a/Lib/imp.py b/Lib/imp.py
--- a/Lib/imp.py
+++ b/Lib/imp.py
@@ -30,7 +30,7 @@
 
 warnings.warn("the imp module is deprecated in favour of importlib; "
               "see the module's documentation for alternative uses",
-              PendingDeprecationWarning, stacklevel=2)
+              DeprecationWarning, stacklevel=2)
 
 # DEPRECATED
 SEARCH_ERROR = 0
diff --git a/Lib/pkgutil.py b/Lib/pkgutil.py
--- a/Lib/pkgutil.py
+++ b/Lib/pkgutil.py
@@ -180,7 +180,7 @@
 def _import_imp():
     global imp
     with warnings.catch_warnings():
-        warnings.simplefilter('ignore', PendingDeprecationWarning)
+        warnings.simplefilter('ignore', DeprecationWarning)
         imp = importlib.import_module('imp')
 
 class ImpImporter:
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -63,6 +63,8 @@
 Library
 -------
 
+- Move the imp module  from a PendingDeprecationWarning to DeprecationWarning.
+
 - Issue #25407: Remove mentions of the formatter module being removed in
   Python 3.6.
 

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list