# HG changeset patch # Parent ca25f9965657c8f0cfa95851f5469b6ad2a635a2 Issue #13248: Remove obsolete objects and arguments. diff --git a/Doc/library/base64.rst b/Doc/library/base64.rst --- a/Doc/library/base64.rst +++ b/Doc/library/base64.rst @@ -134,11 +134,11 @@ .. function:: decodebytes(s) - decodestring(s) Decode the byte string *s*, which must contain one or more lines of base64 encoded data, and return a byte string containing the resulting binary data. - ``decodestring`` is a deprecated alias. + + .. versionchanged:: 3.3 Removed the *decodestring* alias. .. function:: encode(input, output) @@ -151,13 +151,13 @@ .. function:: encodebytes(s) - encodestring(s) Encode the byte string *s*, which can contain arbitrary binary data, and return a byte string containing one or more lines of base64-encoded data. :func:`encodebytes` returns a string containing one or more lines of base64-encoded data always including an extra trailing newline (``b'\n'``). - ``encodestring`` is a deprecated alias. + + .. versionchanged:: 3.3 Removed the *encodestring* alias. An example usage of the module: diff --git a/Doc/library/cgi.rst b/Doc/library/cgi.rst --- a/Doc/library/cgi.rst +++ b/Doc/library/cgi.rst @@ -259,6 +259,11 @@ algorithms implemented in this module in other circumstances. +.. versionchanged:: 3.2 + The :func:`urllib.parse.parse_qs` and the :func:`urllib.parse.parse_qsl` + functions are located in the *urllib.parse* module. + + .. function:: parse(fp=None, environ=os.environ, keep_blank_values=False, strict_parsing=False) Parse a query in the environment or from a file (the file defaults to @@ -266,16 +271,6 @@ passed to :func:`urllib.parse.parse_qs` unchanged. -.. function:: parse_qs(qs, keep_blank_values=False, strict_parsing=False) - - This function is deprecated in this module. Use :func:`urllib.parse.parse_qs` - instead. It is maintained here only for backward compatibility. - -.. function:: parse_qsl(qs, keep_blank_values=False, strict_parsing=False) - - This function is deprecated in this module. Use :func:`urllib.parse.parse_qs` - instead. It is maintained here only for backward compatibility. - .. function:: parse_multipart(fp, pdict) Parse input of type :mimetype:`multipart/form-data` (for file uploads). diff --git a/Doc/library/http.client.rst b/Doc/library/http.client.rst --- a/Doc/library/http.client.rst +++ b/Doc/library/http.client.rst @@ -27,7 +27,7 @@ The module provides the following classes: -.. class:: HTTPConnection(host, port=None[, strict[, timeout[, source_address]]]) +.. class:: HTTPConnection(host, port=None[, timeout[, source_address]]) An :class:`HTTPConnection` instance represents one transaction with an HTTP server. It should be instantiated passing it a host and optional port @@ -50,12 +50,12 @@ .. versionchanged:: 3.2 *source_address* was added. - .. versionchanged:: 3.2 - The *strict* parameter is deprecated. HTTP 0.9-style "Simple Responses" + .. versionchanged:: 3.3 + The *strict* parameter is removed. HTTP 0.9-style "Simple Responses" are not supported anymore. -.. class:: HTTPSConnection(host, port=None, key_file=None, cert_file=None[, strict[, timeout[, source_address]]], *, context=None, check_hostname=None) +.. class:: HTTPSConnection(host, port=None, key_file=None, cert_file=None[, timeout[, source_address]], *, context=None, check_hostname=None) A subclass of :class:`HTTPConnection` that uses SSL for communication with secure servers. Default port is ``443``. If *context* is specified, it @@ -85,18 +85,18 @@ This class now supports HTTPS virtual hosts if possible (that is, if :data:`ssl.HAS_SNI` is true). - .. versionchanged:: 3.2 - The *strict* parameter is deprecated. HTTP 0.9-style "Simple Responses" + .. versionchanged:: 3.3 + The *strict* parameter is removed. HTTP 0.9-style "Simple Responses" are not supported anymore. -.. class:: HTTPResponse(sock, debuglevel=0[, strict], method=None, url=None) +.. class:: HTTPResponse(sock, debuglevel=0, method=None, url=None) Class whose instances are returned upon successful connection. Not instantiated directly by user. - .. versionchanged:: 3.2 - The *strict* parameter is deprecated. HTTP 0.9-style "Simple Responses" + .. versionchanged:: 3.3 + The *strict* parameter is removed. HTTP 0.9-style "Simple Responses" are not supported anymore. diff --git a/Doc/library/os.path.rst b/Doc/library/os.path.rst --- a/Doc/library/os.path.rst +++ b/Doc/library/os.path.rst @@ -39,6 +39,9 @@ * :mod:`macpath` for old-style MacOS paths * :mod:`os2emxpath` for OS/2 EMX paths +.. versionchanged:: 3.3 + *splitunc* function is removed. Use *splitdrive* instead. + .. function:: abspath(path) @@ -305,19 +308,6 @@ returns ``('.cshrc', '')``. -.. function:: splitunc(path) - - .. deprecated:: 3.1 - Use *splitdrive* instead. - - Split the pathname *path* into a pair ``(unc, rest)`` so that *unc* is the UNC - mount point (such as ``r'\\host\mount'``), if present, and *rest* the rest of - the path (such as ``r'\path\file.ext'``). For paths containing drive letters, - *unc* will always be the empty string. - - Availability: Windows. - - .. data:: supports_unicode_filenames True if arbitrary Unicode strings can be used as file names (within limitations diff --git a/Doc/library/tarfile.rst b/Doc/library/tarfile.rst --- a/Doc/library/tarfile.rst +++ b/Doc/library/tarfile.rst @@ -386,16 +386,13 @@ and :meth:`close`, and also supports iteration over its lines. -.. method:: TarFile.add(name, arcname=None, recursive=True, exclude=None, *, filter=None) +.. method:: TarFile.add(name, arcname=None, recursive=True, *, filter=None) Add the file *name* to the archive. *name* may be any type of file (directory, fifo, symbolic link, etc.). If given, *arcname* specifies an alternative name for the file in the archive. Directories are added recursively by default. This can be avoided by setting *recursive* to - :const:`False`. If *exclude* is given, it must be a function that takes one - filename argument and returns a boolean value. Depending on this value the - respective file is either excluded (:const:`True`) or added - (:const:`False`). If *filter* is specified it must be a keyword argument. It + :const:`False`. If *filter* is specified it must be a keyword argument. It should be a function that takes a :class:`TarInfo` object argument and returns the changed :class:`TarInfo` object. If it instead returns :const:`None` the :class:`TarInfo` object will be excluded from the @@ -404,11 +401,12 @@ .. versionchanged:: 3.2 Added the *filter* parameter. - .. deprecated:: 3.2 - The *exclude* parameter is deprecated, please use the *filter* parameter + .. versionchanged:: 3.3 + The *exclude* parameter is removed, please use the *filter* parameter instead. + .. method:: TarFile.addfile(tarinfo, fileobj=None) Add the :class:`TarInfo` object *tarinfo* to the archive. If *fileobj* is given, diff --git a/Lib/asyncore.py b/Lib/asyncore.py --- a/Lib/asyncore.py +++ b/Lib/asyncore.py @@ -50,7 +50,6 @@ import socket import sys import time -import warnings import os from errno import EALREADY, EINPROGRESS, EWOULDBLOCK, ECONNRESET, EINVAL, \ @@ -399,20 +398,6 @@ if why.args[0] not in (ENOTCONN, EBADF): raise - # cheap inheritance, used to pass all other attribute - # references to the underlying socket object. - def __getattr__(self, attr): - try: - retattr = getattr(self.socket, attr) - except AttributeError: - raise AttributeError("%s instance has no attribute '%s'" - %(self.__class__.__name__, attr)) - else: - msg = "%(me)s.%(attr)s is deprecated; use %(me)s.socket.%(attr)s " \ - "instead" % {'me' : self.__class__.__name__, 'attr' : attr} - warnings.warn(msg, DeprecationWarning, stacklevel=2) - return retattr - # log and log_info may be overridden to provide more sophisticated # logging and warning methods. In general, log is for 'hit' logging # and 'log_info' is for informational, warning and error logging. diff --git a/Lib/base64.py b/Lib/base64.py --- a/Lib/base64.py +++ b/Lib/base64.py @@ -345,13 +345,6 @@ pieces.append(binascii.b2a_base64(chunk)) return b"".join(pieces) -def encodestring(s): - """Legacy alias of encodebytes().""" - import warnings - warnings.warn("encodestring() is a deprecated alias, use encodebytes()", - DeprecationWarning, 2) - return encodebytes(s) - def decodebytes(s): """Decode a bytestring of base-64 data into a bytestring.""" @@ -359,13 +352,6 @@ raise TypeError("expected bytes, not %s" % s.__class__.__name__) return binascii.a2b_base64(s) -def decodestring(s): - """Legacy alias of decodebytes().""" - import warnings - warnings.warn("decodestring() is a deprecated alias, use decodebytes()", - DeprecationWarning, 2) - return decodebytes(s) - # Usable as a script... def main(): diff --git a/Lib/cgi.py b/Lib/cgi.py --- a/Lib/cgi.py +++ b/Lib/cgi.py @@ -42,7 +42,7 @@ import tempfile __all__ = ["MiniFieldStorage", "FieldStorage", - "parse", "parse_qs", "parse_qsl", "parse_multipart", + "parse", "parse_multipart", "parse_header", "print_exception", "print_environ", "print_form", "print_directory", "print_arguments", "print_environ_usage", "escape"] @@ -181,21 +181,6 @@ encoding=encoding) -# parse query string function called from urlparse, -# this is done in order to maintain backward compatiblity. - -def parse_qs(qs, keep_blank_values=0, strict_parsing=0): - """Parse a query given as a string argument.""" - warn("cgi.parse_qs is deprecated, use urllib.parse.parse_qs instead", - DeprecationWarning, 2) - return urllib.parse.parse_qs(qs, keep_blank_values, strict_parsing) - -def parse_qsl(qs, keep_blank_values=0, strict_parsing=0): - """Parse a query given as a string argument.""" - warn("cgi.parse_qsl is deprecated, use urllib.parse.parse_qsl instead", - DeprecationWarning, 2) - return urllib.parse.parse_qsl(qs, keep_blank_values, strict_parsing) - def parse_multipart(fp, pdict): """Parse multipart input. diff --git a/Lib/gzip.py b/Lib/gzip.py --- a/Lib/gzip.py +++ b/Lib/gzip.py @@ -183,14 +183,6 @@ if self.mode == WRITE: self._write_gzip_header() - @property - def filename(self): - import warnings - warnings.warn("use the name attribute", DeprecationWarning, 2) - if self.mode == WRITE and self.name[-3:] != ".gz": - return self.name + ".gz" - return self.name - def __repr__(self): fileobj = self.fileobj if isinstance(fileobj, _PaddedFile): diff --git a/Lib/http/client.py b/Lib/http/client.py --- a/Lib/http/client.py +++ b/Lib/http/client.py @@ -73,7 +73,6 @@ import socket import collections from urllib.parse import urlsplit -import warnings __all__ = ["HTTPResponse", "HTTPConnection", "HTTPException", "NotConnected", "UnknownProtocol", @@ -259,8 +258,6 @@ return email.parser.Parser(_class=_class).parsestr(hstring) -_strict_sentinel = object() - class HTTPResponse(io.RawIOBase): # See RFC 2616 sec 19.6 and RFC 1945 sec 6 for details. @@ -270,7 +267,7 @@ # text following RFC 2047. The basic status line parsing only # accepts iso-8859-1. - def __init__(self, sock, debuglevel=0, strict=_strict_sentinel, method=None, url=None): + def __init__(self, sock, debuglevel=0, method=None, url=None): # If the response includes a content-length header, we need to # make sure that the client doesn't read more than the # specified number of bytes. If it does, it will block until @@ -280,10 +277,6 @@ # clients unless they know what they are doing. self.fp = sock.makefile("rb") self.debuglevel = debuglevel - if strict is not _strict_sentinel: - warnings.warn("the 'strict' argument isn't supported anymore; " - "http.client now always assumes HTTP/1.x compliant servers.", - DeprecationWarning, 2) self._method = method # The HTTPResponse object is returned via urllib. The clients @@ -709,12 +702,8 @@ auto_open = 1 debuglevel = 0 - def __init__(self, host, port=None, strict=_strict_sentinel, + def __init__(self, host, port=None, timeout=socket._GLOBAL_DEFAULT_TIMEOUT, source_address=None): - if strict is not _strict_sentinel: - warnings.warn("the 'strict' argument isn't supported anymore; " - "http.client now always assumes HTTP/1.x compliant servers.", - DeprecationWarning, 2) self.timeout = timeout self.source_address = source_address self.sock = None @@ -1143,9 +1132,9 @@ # XXX Should key_file and cert_file be deprecated in favour of context? def __init__(self, host, port=None, key_file=None, cert_file=None, - strict=_strict_sentinel, timeout=socket._GLOBAL_DEFAULT_TIMEOUT, + timeout=socket._GLOBAL_DEFAULT_TIMEOUT, source_address=None, *, context=None, check_hostname=None): - super(HTTPSConnection, self).__init__(host, port, strict, timeout, + super(HTTPSConnection, self).__init__(host, port, timeout, source_address) self.key_file = key_file self.cert_file = cert_file diff --git a/Lib/mailbox.py b/Lib/mailbox.py --- a/Lib/mailbox.py +++ b/Lib/mailbox.py @@ -15,7 +15,6 @@ import socket import errno import copy -import warnings import email import email.message import email.generator @@ -221,9 +220,7 @@ target.write(data) elif isinstance(message, (str, bytes, io.StringIO)): if isinstance(message, io.StringIO): - warnings.warn("Use of StringIO input is deprecated, " - "use BytesIO instead", DeprecationWarning, 3) - message = message.getvalue() + raise TypeError("Use BytesIO instead of StringIO") if isinstance(message, str): message = self._string_to_bytes(message) if mangle_from_: @@ -232,9 +229,7 @@ target.write(message) elif hasattr(message, 'read'): if hasattr(message, 'buffer'): - warnings.warn("Use of text mode files is deprecated, " - "use a binary mode file instead", DeprecationWarning, 3) - message = message.buffer + raise TypeError("Use binary mode instead of text mode file") while True: line = message.readline() # Universal newline support. @@ -1391,9 +1386,7 @@ self._file.write(buffer.replace(b'\n', linesep)) elif isinstance(message, (bytes, str, io.StringIO)): if isinstance(message, io.StringIO): - warnings.warn("Use of StringIO input is deprecated, " - "use BytesIO instead", DeprecationWarning, 3) - message = message.getvalue() + raise TypeError("Use BytesIO instead of StringIO") if isinstance(message, str): message = self._string_to_bytes(message) body_start = message.find(b'\n\n') + 2 @@ -1407,9 +1400,7 @@ self._file.write(message.replace(b'\n', linesep)) elif hasattr(message, 'readline'): if hasattr(message, 'buffer'): - warnings.warn("Use of text mode files is deprecated, " - "use a binary mode file instead", DeprecationWarning, 3) - message = message.buffer + raise TypeError("Use binary mode instead of text mode file") original_pos = message.tell() first_pass = True while True: diff --git a/Lib/ntpath.py b/Lib/ntpath.py --- a/Lib/ntpath.py +++ b/Lib/ntpath.py @@ -15,7 +15,7 @@ "basename","dirname","commonprefix","getsize","getmtime", "getatime","getctime", "islink","exists","lexists","isdir","isfile", "ismount", "expanduser","expandvars","normpath","abspath", - "splitunc","curdir","pardir","sep","pathsep","defpath","altsep", + "curdir","pardir","sep","pathsep","defpath","altsep", "extsep","devnull","realpath","supports_unicode_filenames","relpath", "samefile", "sameopenfile",] @@ -229,42 +229,6 @@ return empty, p -# Parse UNC paths -def splitunc(p): - """Deprecated since Python 3.1. Please use splitdrive() instead; - it now handles UNC paths. - - Split a pathname into UNC mount point and relative path specifiers. - - Return a 2-tuple (unc, rest); either part may be empty. - If unc is not empty, it has the form '//host/mount' (or similar - using backslashes). unc+rest is always the input path. - Paths containing drive letters never have an UNC part. - """ - import warnings - warnings.warn("ntpath.splitunc is deprecated, use ntpath.splitdrive instead", - DeprecationWarning) - sep = _get_sep(p) - if not p[1:2]: - return p[:0], p # Drive letter present - firstTwo = p[0:2] - if normcase(firstTwo) == sep + sep: - # is a UNC path: - # vvvvvvvvvvvvvvvvvvvv equivalent to drive letter - # \\machine\mountpoint\directories... - # directory ^^^^^^^^^^^^^^^ - normp = normcase(p) - index = normp.find(sep, 2) - if index == -1: - ##raise RuntimeError, 'illegal UNC path: "' + p + '"' - return (p[:0], p) - index = normp.find(sep, index + 1) - if index == -1: - index = len(p) - return p[:index], p[index:] - return p[:0], p - - # Split a path in head (everything up to the last '/') and tail (the # rest). After the trailing '/' is stripped, the invariant # join(head, tail) == p holds. diff --git a/Lib/packaging/util.py b/Lib/packaging/util.py --- a/Lib/packaging/util.py +++ b/Lib/packaging/util.py @@ -1002,6 +1002,8 @@ config = RawConfigParser() f = codecs.open(path, encoding='utf-8') try: + config.read_file(f) + except AttributeError: config.readfp(f) finally: f.close() diff --git a/Lib/tarfile.py b/Lib/tarfile.py --- a/Lib/tarfile.py +++ b/Lib/tarfile.py @@ -2018,31 +2018,21 @@ print("link to", tarinfo.linkname, end=' ') print() - def add(self, name, arcname=None, recursive=True, exclude=None, *, filter=None): + def add(self, name, arcname=None, recursive=True, *, filter=None): """Add the file `name' to the archive. `name' may be any type of file (directory, fifo, symbolic link, etc.). If given, `arcname' specifies an alternative name for the file in the archive. Directories are added recursively by default. This can be avoided by - setting `recursive' to False. `exclude' is a function that should - return True for each filename to be excluded. `filter' is a function - that expects a TarInfo object argument and returns the changed - TarInfo object, if it returns None the TarInfo object will be - excluded from the archive. + setting `recursive' to False. `filter' is a function that expects a + TarInfo object argument and returns the changed TarInfo object, if + it returns None the TarInfo object will be excluded + from the archive. """ self._check("aw") if arcname is None: arcname = name - # Exclude pathnames. - if exclude is not None: - import warnings - warnings.warn("use the filter argument instead", - DeprecationWarning, 2) - if exclude(name): - self._dbg(2, "tarfile: Excluded %r" % name) - return - # Skip if somebody tries to archive the archive... if self.name is not None and os.path.abspath(name) == self.name: self._dbg(2, "tarfile: Skipped %r" % name) @@ -2075,7 +2065,7 @@ if recursive: for f in os.listdir(name): self.add(os.path.join(name, f), os.path.join(arcname, f), - recursive, exclude, filter=filter) + recursive, filter=filter) else: self.addfile(tarinfo) diff --git a/Lib/test/test_asyncore.py b/Lib/test/test_asyncore.py --- a/Lib/test/test_asyncore.py +++ b/Lib/test/test_asyncore.py @@ -321,16 +321,10 @@ d = asyncore.dispatcher(socket.socket()) # make sure the error message no longer refers to the socket # object but the dispatcher instance instead - self.assertRaisesRegex(AttributeError, 'dispatcher instance', + self.assertRaisesRegex(AttributeError, "'dispatcher' object has no attribute 'foo'", getattr, d, 'foo') - # cheap inheritance with the underlying socket is supposed - # to still work but a DeprecationWarning is expected - with warnings.catch_warnings(record=True) as w: - warnings.simplefilter("always") - family = d.family - self.assertEqual(family, socket.AF_INET) - self.assertEqual(len(w), 1) - self.assertTrue(issubclass(w[0].category, DeprecationWarning)) + # cheap inheritance with the underlying socket no longer works + self.assertRaises(AttributeError, getattr, d, 'family') def test_strerror(self): # refers to bug #8573 diff --git a/Lib/test/test_cgi.py b/Lib/test/test_cgi.py --- a/Lib/test/test_cgi.py +++ b/Lib/test/test_cgi.py @@ -303,19 +303,10 @@ v = gen_result(data, environ) self.assertEqual(result, v) - def test_deprecated_parse_qs(self): - # this func is moved to urllib.parse, this is just a sanity check - with check_warnings(('cgi.parse_qs is deprecated, use urllib.parse.' - 'parse_qs instead', DeprecationWarning)): - self.assertEqual({'a': ['A1'], 'B': ['B3'], 'b': ['B2']}, - cgi.parse_qs('a=A1&b=B2&B=B3')) - - def test_deprecated_parse_qsl(self): - # this func is moved to urllib.parse, this is just a sanity check - with check_warnings(('cgi.parse_qsl is deprecated, use urllib.parse.' - 'parse_qsl instead', DeprecationWarning)): - self.assertEqual([('a', 'A1'), ('b', 'B2'), ('B', 'B3')], - cgi.parse_qsl('a=A1&b=B2&B=B3')) + def test_moved_functions(self): + # these funcs are moved to urllib.parse, this is just a sanity check + self.assertRaises(AttributeError, getattr, cgi, 'parse_qs') + self.assertRaises(AttributeError, getattr, cgi, 'parse_qsl') def test_parse_header(self): self.assertEqual( diff --git a/Lib/test/test_mailbox.py b/Lib/test/test_mailbox.py --- a/Lib/test/test_mailbox.py +++ b/Lib/test/test_mailbox.py @@ -79,12 +79,11 @@ self.assertEqual(len(self._box), 5) keys.append(self._box.add(_bytes_sample_message)) self.assertEqual(len(self._box), 6) - with self.assertWarns(DeprecationWarning): - keys.append(self._box.add( - io.TextIOWrapper(io.BytesIO(_bytes_sample_message)))) - self.assertEqual(len(self._box), 7) + self.assertRaises(TypeError, self._box.add, + io.TextIOWrapper(io.BytesIO(_bytes_sample_message))) + self.assertEqual(len(self._box), 6) self.assertEqual(self._box.get_string(keys[0]), self._template % 0) - for i in (1, 2, 3, 4, 5, 6): + for i in (1, 2, 3, 4, 5): self._check_sample(self._box[keys[i]]) _nonascii_msg = textwrap.dedent("""\ @@ -167,26 +166,15 @@ self.assertEqual(self._box.get_bytes(key).split(b'\n'), self._non_latin_bin_msg.split(b'\n')) - def test_add_text_file_warns(self): + def test_add_text_file_raises(self): with tempfile.TemporaryFile('w+') as f: f.write(_sample_message) f.seek(0) - with self.assertWarns(DeprecationWarning): - key = self._box.add(f) - # See issue 11062 - if not isinstance(self._box, mailbox.Babyl): - self.assertEqual(self._box.get_bytes(key).split(b'\n'), - _bytes_sample_message.split(b'\n')) + self.assertRaises(TypeError, self._box.add, f) - def test_add_StringIO_warns(self): - with self.assertWarns(DeprecationWarning): - key = self._box.add(io.StringIO(self._template % "0")) - self.assertEqual(self._box.get_string(key), self._template % "0") - - def test_add_nonascii_StringIO_raises(self): - with self.assertWarns(DeprecationWarning): - with self.assertRaisesRegex(ValueError, "ASCII-only"): - self._box.add(io.StringIO(self._nonascii_msg)) + def test_add_StringIO_raises(self): + self.assertRaises(TypeError, self._box.add, io.StringIO(self._template % "0")) + self.assertRaises(TypeError, self._box.add, io.StringIO(self._nonascii_msg)) self.assertEqual(len(self._box), 0) self._box.close() self.assertMailboxEmpty() diff --git a/Lib/test/test_ntpath.py b/Lib/test/test_ntpath.py --- a/Lib/test/test_ntpath.py +++ b/Lib/test/test_ntpath.py @@ -259,7 +259,7 @@ class NtCommonTest(test_genericpath.CommonTest): pathmodule = ntpath - attributes = ['relpath', 'splitunc'] + attributes = ['relpath'] def test_main(): diff --git a/Lib/test/test_sys.py b/Lib/test/test_sys.py --- a/Lib/test/test_sys.py +++ b/Lib/test/test_sys.py @@ -3,7 +3,6 @@ import struct import subprocess import textwrap -import warnings import operator import codecs @@ -182,13 +181,8 @@ # testing sys.setprofile() is done in test_sys_setprofile.py def test_setcheckinterval(self): - with warnings.catch_warnings(): - warnings.simplefilter("ignore") - self.assertRaises(TypeError, sys.setcheckinterval) - orig = sys.getcheckinterval() - for n in 0, 100, 120, orig: # orig last to restore starting state - sys.setcheckinterval(n) - self.assertEqual(sys.getcheckinterval(), n) + self.assertRaises(AttributeError, getattr, sys, 'getcheckinterval') + self.assertRaises(AttributeError, getattr, sys, 'setcheckinterval') @unittest.skipUnless(threading, 'Threading required for this test.') def test_switchinterval(self): diff --git a/Lib/test/test_tarfile.py b/Lib/test/test_tarfile.py --- a/Lib/test/test_tarfile.py +++ b/Lib/test/test_tarfile.py @@ -927,33 +927,6 @@ finally: tar.close() - def test_exclude(self): - tempdir = os.path.join(TEMPDIR, "exclude") - os.mkdir(tempdir) - try: - for name in ("foo", "bar", "baz"): - name = os.path.join(tempdir, name) - support.create_empty_file(name) - - exclude = os.path.isfile - - tar = tarfile.open(tmpname, self.mode, encoding="iso8859-1") - try: - with support.check_warnings(("use the filter argument", - DeprecationWarning)): - tar.add(tempdir, arcname="empty_dir", exclude=exclude) - finally: - tar.close() - - tar = tarfile.open(tmpname, "r") - try: - self.assertEqual(len(tar.getmembers()), 1) - self.assertEqual(tar.getnames()[0], "empty_dir") - finally: - tar.close() - finally: - shutil.rmtree(tempdir) - def test_filter(self): tempdir = os.path.join(TEMPDIR, "filter") os.mkdir(tempdir) diff --git a/Lib/trace.py b/Lib/trace.py --- a/Lib/trace.py +++ b/Lib/trace.py @@ -60,7 +60,6 @@ import gc import dis import pickle -from warnings import warn as _warn try: import threading @@ -811,47 +810,6 @@ if not no_report: results.write_results(missing, summary=summary, coverdir=coverdir) -# Deprecated API -def usage(outfile): - _warn("The trace.usage() function is deprecated", - DeprecationWarning, 2) - _usage(outfile) - -class Ignore(_Ignore): - def __init__(self, modules=None, dirs=None): - _warn("The class trace.Ignore is deprecated", - DeprecationWarning, 2) - _Ignore.__init__(self, modules, dirs) - -def modname(path): - _warn("The trace.modname() function is deprecated", - DeprecationWarning, 2) - return _modname(path) - -def fullmodname(path): - _warn("The trace.fullmodname() function is deprecated", - DeprecationWarning, 2) - return _fullmodname(path) - -def find_lines_from_code(code, strs): - _warn("The trace.find_lines_from_code() function is deprecated", - DeprecationWarning, 2) - return _find_lines_from_code(code, strs) - -def find_lines(code, strs): - _warn("The trace.find_lines() function is deprecated", - DeprecationWarning, 2) - return _find_lines(code, strs) - -def find_strings(filename, encoding=None): - _warn("The trace.find_strings() function is deprecated", - DeprecationWarning, 2) - return _find_strings(filename, encoding=None) - -def find_executable_linenos(filename): - _warn("The trace.find_executable_linenos() function is deprecated", - DeprecationWarning, 2) - return _find_executable_linenos(filename) if __name__=='__main__': main() diff --git a/Python/sysmodule.c b/Python/sysmodule.c --- a/Python/sysmodule.c +++ b/Python/sysmodule.c @@ -489,44 +489,6 @@ See the profiler chapter in the library manual." ); -static int _check_interval = 100; - -static PyObject * -sys_setcheckinterval(PyObject *self, PyObject *args) -{ - if (PyErr_WarnEx(PyExc_DeprecationWarning, - "sys.getcheckinterval() and sys.setcheckinterval() " - "are deprecated. Use sys.setswitchinterval() " - "instead.", 1) < 0) - return NULL; - if (!PyArg_ParseTuple(args, "i:setcheckinterval", &_check_interval)) - return NULL; - Py_INCREF(Py_None); - return Py_None; -} - -PyDoc_STRVAR(setcheckinterval_doc, -"setcheckinterval(n)\n\ -\n\ -Tell the Python interpreter to check for asynchronous events every\n\ -n instructions. This also affects how often thread switches occur." -); - -static PyObject * -sys_getcheckinterval(PyObject *self, PyObject *args) -{ - if (PyErr_WarnEx(PyExc_DeprecationWarning, - "sys.getcheckinterval() and sys.setcheckinterval() " - "are deprecated. Use sys.getswitchinterval() " - "instead.", 1) < 0) - return NULL; - return PyLong_FromLong(_check_interval); -} - -PyDoc_STRVAR(getcheckinterval_doc, -"getcheckinterval() -> current check interval; see setcheckinterval()." -); - #ifdef WITH_THREAD static PyObject * sys_setswitchinterval(PyObject *self, PyObject *args) @@ -1069,10 +1031,6 @@ #ifdef USE_MALLOPT {"mdebug", sys_mdebug, METH_VARARGS}, #endif - {"setcheckinterval", sys_setcheckinterval, METH_VARARGS, - setcheckinterval_doc}, - {"getcheckinterval", sys_getcheckinterval, METH_NOARGS, - getcheckinterval_doc}, #ifdef WITH_THREAD {"setswitchinterval", sys_setswitchinterval, METH_VARARGS, setswitchinterval_doc}, @@ -1298,7 +1256,6 @@ getrecursionlimit() -- return the max recursion depth for the interpreter\n\ getsizeof() -- return the size of an object in bytes\n\ gettrace() -- get the global debug tracing function\n\ -setcheckinterval() -- control how often the interpreter checks for events\n\ setdlopenflags() -- set the flags to be used for dlopen() calls\n\ setprofile() -- set the global profiling function\n\ setrecursionlimit() -- set the max recursion depth for the interpreter\n\