[Python-checkins] cpython: Issue #13248: turn 3.2's PendingDeprecationWarning into 3.3's

florent.xicluna python-checkins at python.org
Sat Dec 10 11:08:22 CET 2011


http://hg.python.org/cpython/rev/f82ebf9b3a52
changeset:   73914:f82ebf9b3a52
user:        Florent Xicluna <florent.xicluna at gmail.com>
date:        Sat Dec 10 11:07:42 2011 +0100
summary:
  Issue #13248: turn 3.2's PendingDeprecationWarning into 3.3's DeprecationWarning (cgi, importlib, nntplib, smtpd).

files:
  Doc/library/nntplib.rst                      |   3 +
  Lib/cgi.py                                   |   2 +-
  Lib/importlib/abc.py                         |   4 +-
  Lib/importlib/test/source/test_abc_loader.py |   4 +-
  Lib/nntplib.py                               |   4 +-
  Lib/smtpd.py                                 |  44 +++++-----
  Lib/test/test_smtpd.py                       |  44 +++++-----
  Misc/NEWS                                    |   5 +
  8 files changed, 59 insertions(+), 51 deletions(-)


diff --git a/Doc/library/nntplib.rst b/Doc/library/nntplib.rst
--- a/Doc/library/nntplib.rst
+++ b/Doc/library/nntplib.rst
@@ -517,6 +517,9 @@
    article with message ID *id*.  Most of the time, this extension is not
    enabled by NNTP server administrators.
 
+   .. deprecated:: 3.3
+      The XPATH extension is not actively used.
+
 
 .. XXX deprecated:
 
diff --git a/Lib/cgi.py b/Lib/cgi.py
--- a/Lib/cgi.py
+++ b/Lib/cgi.py
@@ -1012,7 +1012,7 @@
 def escape(s, quote=None):
     """Deprecated API."""
     warn("cgi.escape is deprecated, use html.escape instead",
-         PendingDeprecationWarning, stacklevel=2)
+         DeprecationWarning, stacklevel=2)
     s = s.replace("&", "&amp;") # Must be done first!
     s = s.replace("<", "&lt;")
     s = s.replace(">", "&gt;")
diff --git a/Lib/importlib/abc.py b/Lib/importlib/abc.py
--- a/Lib/importlib/abc.py
+++ b/Lib/importlib/abc.py
@@ -195,7 +195,7 @@
                             "use SourceLoader instead. "
                             "See the importlib documentation on how to be "
                             "compatible with Python 3.1 onwards.",
-                        PendingDeprecationWarning)
+                        DeprecationWarning)
         path = self.source_path(fullname)
         if path is None:
             raise ImportError
@@ -234,7 +234,7 @@
                             "removal in Python 3.4; use SourceLoader instead. "
                             "If Python 3.1 compatibility is required, see the "
                             "latest documentation for PyLoader.",
-                        PendingDeprecationWarning)
+                        DeprecationWarning)
         source_timestamp = self.source_mtime(fullname)
         # Try to use bytecode if it is available.
         bytecode_path = self.bytecode_path(fullname)
diff --git a/Lib/importlib/test/source/test_abc_loader.py b/Lib/importlib/test/source/test_abc_loader.py
--- a/Lib/importlib/test/source/test_abc_loader.py
+++ b/Lib/importlib/test/source/test_abc_loader.py
@@ -102,7 +102,7 @@
             warnings.simplefilter("always")
             path = super().get_filename(name)
             assert len(w) == 1
-            assert issubclass(w[0].category, PendingDeprecationWarning)
+            assert issubclass(w[0].category, DeprecationWarning)
             return path
 
 
@@ -198,7 +198,7 @@
             warnings.simplefilter("always")
             code_object = super().get_code(name)
             assert len(w) == 1
-            assert issubclass(w[0].category, PendingDeprecationWarning)
+            assert issubclass(w[0].category, DeprecationWarning)
             return code_object
 
 class PyLoaderTests(testing_abc.LoaderTests):
diff --git a/Lib/nntplib.py b/Lib/nntplib.py
--- a/Lib/nntplib.py
+++ b/Lib/nntplib.py
@@ -828,7 +828,7 @@
         - list: list of (name,title) strings"""
         warnings.warn("The XGTITLE extension is not actively used, "
                       "use descriptions() instead",
-                      PendingDeprecationWarning, 2)
+                      DeprecationWarning, 2)
         line_pat = re.compile('^([^ \t]+)[ \t]+(.*)$')
         resp, raw_lines = self._longcmdstring('XGTITLE ' + group, file)
         lines = []
@@ -846,7 +846,7 @@
         path: directory path to article
         """
         warnings.warn("The XPATH extension is not actively used",
-                      PendingDeprecationWarning, 2)
+                      DeprecationWarning, 2)
 
         resp = self._shortcmd('XPATH {0}'.format(id))
         if not resp.startswith('223'):
diff --git a/Lib/smtpd.py b/Lib/smtpd.py
--- a/Lib/smtpd.py
+++ b/Lib/smtpd.py
@@ -142,122 +142,122 @@
     @property
     def __server(self):
         warn("Access to __server attribute on SMTPChannel is deprecated, "
-            "use 'smtp_server' instead", PendingDeprecationWarning, 2)
+            "use 'smtp_server' instead", DeprecationWarning, 2)
         return self.smtp_server
     @__server.setter
     def __server(self, value):
         warn("Setting __server attribute on SMTPChannel is deprecated, "
-            "set 'smtp_server' instead", PendingDeprecationWarning, 2)
+            "set 'smtp_server' instead", DeprecationWarning, 2)
         self.smtp_server = value
 
     @property
     def __line(self):
         warn("Access to __line attribute on SMTPChannel is deprecated, "
-            "use 'received_lines' instead", PendingDeprecationWarning, 2)
+            "use 'received_lines' instead", DeprecationWarning, 2)
         return self.received_lines
     @__line.setter
     def __line(self, value):
         warn("Setting __line attribute on SMTPChannel is deprecated, "
-            "set 'received_lines' instead", PendingDeprecationWarning, 2)
+            "set 'received_lines' instead", DeprecationWarning, 2)
         self.received_lines = value
 
     @property
     def __state(self):
         warn("Access to __state attribute on SMTPChannel is deprecated, "
-            "use 'smtp_state' instead", PendingDeprecationWarning, 2)
+            "use 'smtp_state' instead", DeprecationWarning, 2)
         return self.smtp_state
     @__state.setter
     def __state(self, value):
         warn("Setting __state attribute on SMTPChannel is deprecated, "
-            "set 'smtp_state' instead", PendingDeprecationWarning, 2)
+            "set 'smtp_state' instead", DeprecationWarning, 2)
         self.smtp_state = value
 
     @property
     def __greeting(self):
         warn("Access to __greeting attribute on SMTPChannel is deprecated, "
-            "use 'seen_greeting' instead", PendingDeprecationWarning, 2)
+            "use 'seen_greeting' instead", DeprecationWarning, 2)
         return self.seen_greeting
     @__greeting.setter
     def __greeting(self, value):
         warn("Setting __greeting attribute on SMTPChannel is deprecated, "
-            "set 'seen_greeting' instead", PendingDeprecationWarning, 2)
+            "set 'seen_greeting' instead", DeprecationWarning, 2)
         self.seen_greeting = value
 
     @property
     def __mailfrom(self):
         warn("Access to __mailfrom attribute on SMTPChannel is deprecated, "
-            "use 'mailfrom' instead", PendingDeprecationWarning, 2)
+            "use 'mailfrom' instead", DeprecationWarning, 2)
         return self.mailfrom
     @__mailfrom.setter
     def __mailfrom(self, value):
         warn("Setting __mailfrom attribute on SMTPChannel is deprecated, "
-            "set 'mailfrom' instead", PendingDeprecationWarning, 2)
+            "set 'mailfrom' instead", DeprecationWarning, 2)
         self.mailfrom = value
 
     @property
     def __rcpttos(self):
         warn("Access to __rcpttos attribute on SMTPChannel is deprecated, "
-            "use 'rcpttos' instead", PendingDeprecationWarning, 2)
+            "use 'rcpttos' instead", DeprecationWarning, 2)
         return self.rcpttos
     @__rcpttos.setter
     def __rcpttos(self, value):
         warn("Setting __rcpttos attribute on SMTPChannel is deprecated, "
-            "set 'rcpttos' instead", PendingDeprecationWarning, 2)
+            "set 'rcpttos' instead", DeprecationWarning, 2)
         self.rcpttos = value
 
     @property
     def __data(self):
         warn("Access to __data attribute on SMTPChannel is deprecated, "
-            "use 'received_data' instead", PendingDeprecationWarning, 2)
+            "use 'received_data' instead", DeprecationWarning, 2)
         return self.received_data
     @__data.setter
     def __data(self, value):
         warn("Setting __data attribute on SMTPChannel is deprecated, "
-            "set 'received_data' instead", PendingDeprecationWarning, 2)
+            "set 'received_data' instead", DeprecationWarning, 2)
         self.received_data = value
 
     @property
     def __fqdn(self):
         warn("Access to __fqdn attribute on SMTPChannel is deprecated, "
-            "use 'fqdn' instead", PendingDeprecationWarning, 2)
+            "use 'fqdn' instead", DeprecationWarning, 2)
         return self.fqdn
     @__fqdn.setter
     def __fqdn(self, value):
         warn("Setting __fqdn attribute on SMTPChannel is deprecated, "
-            "set 'fqdn' instead", PendingDeprecationWarning, 2)
+            "set 'fqdn' instead", DeprecationWarning, 2)
         self.fqdn = value
 
     @property
     def __peer(self):
         warn("Access to __peer attribute on SMTPChannel is deprecated, "
-            "use 'peer' instead", PendingDeprecationWarning, 2)
+            "use 'peer' instead", DeprecationWarning, 2)
         return self.peer
     @__peer.setter
     def __peer(self, value):
         warn("Setting __peer attribute on SMTPChannel is deprecated, "
-            "set 'peer' instead", PendingDeprecationWarning, 2)
+            "set 'peer' instead", DeprecationWarning, 2)
         self.peer = value
 
     @property
     def __conn(self):
         warn("Access to __conn attribute on SMTPChannel is deprecated, "
-            "use 'conn' instead", PendingDeprecationWarning, 2)
+            "use 'conn' instead", DeprecationWarning, 2)
         return self.conn
     @__conn.setter
     def __conn(self, value):
         warn("Setting __conn attribute on SMTPChannel is deprecated, "
-            "set 'conn' instead", PendingDeprecationWarning, 2)
+            "set 'conn' instead", DeprecationWarning, 2)
         self.conn = value
 
     @property
     def __addr(self):
         warn("Access to __addr attribute on SMTPChannel is deprecated, "
-            "use 'addr' instead", PendingDeprecationWarning, 2)
+            "use 'addr' instead", DeprecationWarning, 2)
         return self.addr
     @__addr.setter
     def __addr(self, value):
         warn("Setting __addr attribute on SMTPChannel is deprecated, "
-            "set 'addr' instead", PendingDeprecationWarning, 2)
+            "set 'addr' instead", DeprecationWarning, 2)
         self.addr = value
 
     # Overrides base class for convenience
diff --git a/Lib/test/test_smtpd.py b/Lib/test/test_smtpd.py
--- a/Lib/test/test_smtpd.py
+++ b/Lib/test/test_smtpd.py
@@ -239,49 +239,49 @@
         self.assertEqual(self.channel.socket.last, b'501 Syntax: RSET\r\n')
 
     def test_attribute_deprecations(self):
-        with support.check_warnings(('', PendingDeprecationWarning)):
+        with support.check_warnings(('', DeprecationWarning)):
             spam = self.channel._SMTPChannel__server
-        with support.check_warnings(('', PendingDeprecationWarning)):
+        with support.check_warnings(('', DeprecationWarning)):
             self.channel._SMTPChannel__server = 'spam'
-        with support.check_warnings(('', PendingDeprecationWarning)):
+        with support.check_warnings(('', DeprecationWarning)):
             spam = self.channel._SMTPChannel__line
-        with support.check_warnings(('', PendingDeprecationWarning)):
+        with support.check_warnings(('', DeprecationWarning)):
             self.channel._SMTPChannel__line = 'spam'
-        with support.check_warnings(('', PendingDeprecationWarning)):
+        with support.check_warnings(('', DeprecationWarning)):
             spam = self.channel._SMTPChannel__state
-        with support.check_warnings(('', PendingDeprecationWarning)):
+        with support.check_warnings(('', DeprecationWarning)):
             self.channel._SMTPChannel__state = 'spam'
-        with support.check_warnings(('', PendingDeprecationWarning)):
+        with support.check_warnings(('', DeprecationWarning)):
             spam = self.channel._SMTPChannel__greeting
-        with support.check_warnings(('', PendingDeprecationWarning)):
+        with support.check_warnings(('', DeprecationWarning)):
             self.channel._SMTPChannel__greeting = 'spam'
-        with support.check_warnings(('', PendingDeprecationWarning)):
+        with support.check_warnings(('', DeprecationWarning)):
             spam = self.channel._SMTPChannel__mailfrom
-        with support.check_warnings(('', PendingDeprecationWarning)):
+        with support.check_warnings(('', DeprecationWarning)):
             self.channel._SMTPChannel__mailfrom = 'spam'
-        with support.check_warnings(('', PendingDeprecationWarning)):
+        with support.check_warnings(('', DeprecationWarning)):
             spam = self.channel._SMTPChannel__rcpttos
-        with support.check_warnings(('', PendingDeprecationWarning)):
+        with support.check_warnings(('', DeprecationWarning)):
             self.channel._SMTPChannel__rcpttos = 'spam'
-        with support.check_warnings(('', PendingDeprecationWarning)):
+        with support.check_warnings(('', DeprecationWarning)):
             spam = self.channel._SMTPChannel__data
-        with support.check_warnings(('', PendingDeprecationWarning)):
+        with support.check_warnings(('', DeprecationWarning)):
             self.channel._SMTPChannel__data = 'spam'
-        with support.check_warnings(('', PendingDeprecationWarning)):
+        with support.check_warnings(('', DeprecationWarning)):
             spam = self.channel._SMTPChannel__fqdn
-        with support.check_warnings(('', PendingDeprecationWarning)):
+        with support.check_warnings(('', DeprecationWarning)):
             self.channel._SMTPChannel__fqdn = 'spam'
-        with support.check_warnings(('', PendingDeprecationWarning)):
+        with support.check_warnings(('', DeprecationWarning)):
             spam = self.channel._SMTPChannel__peer
-        with support.check_warnings(('', PendingDeprecationWarning)):
+        with support.check_warnings(('', DeprecationWarning)):
             self.channel._SMTPChannel__peer = 'spam'
-        with support.check_warnings(('', PendingDeprecationWarning)):
+        with support.check_warnings(('', DeprecationWarning)):
             spam = self.channel._SMTPChannel__conn
-        with support.check_warnings(('', PendingDeprecationWarning)):
+        with support.check_warnings(('', DeprecationWarning)):
             self.channel._SMTPChannel__conn = 'spam'
-        with support.check_warnings(('', PendingDeprecationWarning)):
+        with support.check_warnings(('', DeprecationWarning)):
             spam = self.channel._SMTPChannel__addr
-        with support.check_warnings(('', PendingDeprecationWarning)):
+        with support.check_warnings(('', DeprecationWarning)):
             self.channel._SMTPChannel__addr = 'spam'
 
 def test_main():
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -406,6 +406,11 @@
 Library
 -------
 
+- Issue #13248: Turn 3.2's PendingDeprecationWarning into 3.3's
+  DeprecationWarning.  It covers 'cgi.escape', 'importlib.abc.PyLoader',
+  'importlib.abc.PyPycLoader', 'nntplib.NNTP.xgtitle', 'nntplib.NNTP.xpath',
+  and private attributes of 'smtpd.SMTPChannel'.
+
 - Issue #5905: time.strftime() is now using the locale encoding, instead of
   UTF-8, if the wcsftime() function is not available.
 

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


More information about the Python-checkins mailing list