[Python-checkins] bpo-39366: Remove xpath() and xgtitle() methods of NNTP (GH-18035)

Berker Peksag webhook-mailer at python.org
Wed Jan 22 16:59:48 EST 2020


https://github.com/python/cpython/commit/1f0f102dec506fd06f912b74dd2be64a7fba0d3f
commit: 1f0f102dec506fd06f912b74dd2be64a7fba0d3f
branch: master
author: Dong-hee Na <donghee.na92 at gmail.com>
committer: Berker Peksag <berker.peksag at gmail.com>
date: 2020-01-23T00:59:43+03:00
summary:

bpo-39366: Remove xpath() and xgtitle() methods of NNTP (GH-18035)

files:
A Misc/NEWS.d/next/Library/2020-01-17-18-14-51.bpo-39366.Cv3NQS.rst
M Doc/library/nntplib.rst
M Doc/whatsnew/3.9.rst
M Lib/nntplib.py

diff --git a/Doc/library/nntplib.rst b/Doc/library/nntplib.rst
index 76973651526a8..e7ec9047e015e 100644
--- a/Doc/library/nntplib.rst
+++ b/Doc/library/nntplib.rst
@@ -542,33 +542,6 @@ them have been superseded by newer commands in :rfc:`3977`.
    if available.
 
 
-.. method:: NNTP.xpath(id)
-
-   Return a pair ``(resp, path)``, where *path* is the directory path to the
-   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:
-
-   .. method:: NNTP.xgtitle(name, *, file=None)
-
-      Process an ``XGTITLE`` command, returning a pair ``(response, list)``, where
-      *list* is a list of tuples containing ``(name, title)``. If the *file* parameter
-      is supplied, then the output of the  ``XGTITLE`` command is stored in a file.
-      If *file* is a string,  then the method will open a file with that name, write
-      to it  then close it.  If *file* is a :term:`file object`, then it will start
-      calling :meth:`write` on it to store the lines of the command output. If *file*
-      is supplied, then the returned *list* is an empty list. This is an optional NNTP
-      extension, and may not be supported by all servers.
-
-      :rfc:`2980` says "It is suggested that this extension be deprecated".  Use
-      :meth:`descriptions` or :meth:`description` instead.
-
-
 Utility functions
 -----------------
 
diff --git a/Doc/whatsnew/3.9.rst b/Doc/whatsnew/3.9.rst
index f5835d68515ac..d9c545adc43d6 100644
--- a/Doc/whatsnew/3.9.rst
+++ b/Doc/whatsnew/3.9.rst
@@ -363,6 +363,13 @@ Deprecated
 Removed
 =======
 
+* :class:`nntplib.NNTP`: ``xpath()`` and ``xgtitle()`` methods have been removed.
+  These methods are deprecated since Python 3.3. Generally, these extensions
+  are not supported or not enabled by NNTP server administrators.
+  For ``xgtitle()``, please use :meth:`nntplib.NNTP.descriptions` or
+  :meth:`nntplib.NNTP.description` instead.
+  (Contributed by Dong-hee Na in :issue:`39366`.)
+
 * :class:`array.array`: ``tostring()`` and ``fromstring()`` methods have been
   removed. They were aliases to ``tobytes()`` and ``frombytes()``, deprecated
   since Python 3.2.
diff --git a/Lib/nntplib.py b/Lib/nntplib.py
index 8951203f325c8..aa9b46a8aaa39 100644
--- a/Lib/nntplib.py
+++ b/Lib/nntplib.py
@@ -67,7 +67,6 @@
 import socket
 import collections
 import datetime
-import warnings
 import sys
 
 try:
@@ -834,44 +833,6 @@ def over(self, message_spec, *, file=None):
         fmt = self._getoverviewfmt()
         return resp, _parse_overview(lines, fmt)
 
-    def xgtitle(self, group, *, file=None):
-        """Process an XGTITLE command (optional server extension) Arguments:
-        - group: group name wildcard (i.e. news.*)
-        Returns:
-        - resp: server response if successful
-        - list: list of (name,title) strings"""
-        warnings.warn("The XGTITLE extension is not actively used, "
-                      "use descriptions() instead",
-                      DeprecationWarning, 2)
-        line_pat = re.compile('^([^ \t]+)[ \t]+(.*)$')
-        resp, raw_lines = self._longcmdstring('XGTITLE ' + group, file)
-        lines = []
-        for raw_line in raw_lines:
-            match = line_pat.search(raw_line.strip())
-            if match:
-                lines.append(match.group(1, 2))
-        return resp, lines
-
-    def xpath(self, id):
-        """Process an XPATH command (optional server extension) Arguments:
-        - id: Message id of article
-        Returns:
-        resp: server response if successful
-        path: directory path to article
-        """
-        warnings.warn("The XPATH extension is not actively used",
-                      DeprecationWarning, 2)
-
-        resp = self._shortcmd('XPATH {0}'.format(id))
-        if not resp.startswith('223'):
-            raise NNTPReplyError(resp)
-        try:
-            [resp_num, path] = resp.split()
-        except ValueError:
-            raise NNTPReplyError(resp) from None
-        else:
-            return resp, path
-
     def date(self):
         """Process the DATE command.
         Returns:
diff --git a/Misc/NEWS.d/next/Library/2020-01-17-18-14-51.bpo-39366.Cv3NQS.rst b/Misc/NEWS.d/next/Library/2020-01-17-18-14-51.bpo-39366.Cv3NQS.rst
new file mode 100644
index 0000000000000..00d98a7f183ae
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2020-01-17-18-14-51.bpo-39366.Cv3NQS.rst
@@ -0,0 +1,2 @@
+The previously deprecated ``xpath()`` and ``xgtitle()`` methods of
+:class:`nntplib.NNTP` have been removed.



More information about the Python-checkins mailing list