Issue #13248: turn 3.2's PendingDeprecationWarning into 3.3's DeprecationWarning (cgi, importlib, nntplib, smtpd).
This commit is contained in:
parent
720682efd1
commit
67317750af
|
@ -517,6 +517,9 @@ them have been superseded by newer commands in :rfc:`3977`.
|
|||
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:
|
||||
|
||||
|
|
|
@ -1012,7 +1012,7 @@ environment as well. Here are some common variable names:
|
|||
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("&", "&") # Must be done first!
|
||||
s = s.replace("<", "<")
|
||||
s = s.replace(">", ">")
|
||||
|
|
|
@ -195,7 +195,7 @@ class PyLoader(SourceLoader):
|
|||
"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 @@ class PyPycLoader(PyLoader):
|
|||
"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)
|
||||
|
|
|
@ -102,7 +102,7 @@ class PyLoaderMock(abc.PyLoader):
|
|||
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 @@ class PyPycLoaderMock(abc.PyPycLoader, PyLoaderMock):
|
|||
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):
|
||||
|
|
|
@ -828,7 +828,7 @@ class _NNTPBase:
|
|||
- 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 @@ class _NNTPBase:
|
|||
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'):
|
||||
|
|
44
Lib/smtpd.py
44
Lib/smtpd.py
|
@ -142,122 +142,122 @@ class SMTPChannel(asynchat.async_chat):
|
|||
@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
|
||||
|
|
|
@ -239,49 +239,49 @@ class SMTPDChannelTest(TestCase):
|
|||
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():
|
||||
|
|
|
@ -406,6 +406,11 @@ Core and Builtins
|
|||
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.
|
||||
|
||||
|
|
Loading…
Reference in New Issue