From 4c6f8ccdede472de6b42b5d731a0bffa64acb30f Mon Sep 17 00:00:00 2001 From: Zearin Date: Fri, 23 Oct 2015 13:17:19 -0400 Subject: [PATCH] Move ``deprecated::`` blocks to the beginning of their documentation --- Doc/c-api/init.rst | 10 +-- Doc/c-api/long.rst | 8 +-- Doc/c-api/module.rst | 6 +- Doc/c-api/unicode.rst | 116 +++++++++++++++++----------------- Doc/library/abc.rst | 25 ++++---- Doc/library/asyncio-task.rst | 4 +- Doc/library/asyncore.rst | 4 +- Doc/library/cgi.rst | 8 +-- Doc/library/fileinput.rst | 6 +- Doc/library/fractions.rst | 6 +- Doc/library/ftplib.rst | 8 +-- Doc/library/hmac.rst | 6 +- Doc/library/http.cookies.rst | 16 ++--- Doc/library/idle.rst | 4 +- Doc/library/imp.rst | 110 ++++++++++++++++---------------- Doc/library/importlib.rst | 98 ++++++++++++++-------------- Doc/library/inspect.rst | 34 +++++----- Doc/library/nntplib.rst | 6 +- Doc/library/os.rst | 4 +- Doc/library/pkgutil.rst | 12 ++-- Doc/library/platform.rst | 16 ++--- Doc/library/plistlib.rst | 24 +++---- Doc/library/re.rst | 25 ++++---- Doc/library/string.rst | 8 +-- Doc/library/subprocess.rst | 4 +- Doc/library/sys.rst | 14 ++-- Doc/library/tarfile.rst | 8 +-- Doc/library/time.rst | 10 +-- Doc/library/turtle.rst | 4 +- Doc/library/xml.etree.elementtree.rst | 14 ++-- Doc/library/zipfile.rst | 11 ++-- 31 files changed, 315 insertions(+), 314 deletions(-) diff --git a/Doc/c-api/init.rst b/Doc/c-api/init.rst index 81823bf..1a9ee63 100644 --- a/Doc/c-api/init.rst +++ b/Doc/c-api/init.rst @@ -854,24 +854,24 @@ been created. .. c:function:: void PyEval_AcquireLock() - Acquire the global interpreter lock. The lock must have been created earlier. - If this thread already has the lock, a deadlock ensues. - .. deprecated:: 3.2 This function does not update the current thread state. Please use :c:func:`PyEval_RestoreThread` or :c:func:`PyEval_AcquireThread` instead. + Acquire the global interpreter lock. The lock must have been created earlier. + If this thread already has the lock, a deadlock ensues. + .. c:function:: void PyEval_ReleaseLock() - Release the global interpreter lock. The lock must have been created earlier. - .. deprecated:: 3.2 This function does not update the current thread state. Please use :c:func:`PyEval_SaveThread` or :c:func:`PyEval_ReleaseThread` instead. + Release the global interpreter lock. The lock must have been created earlier. + .. _sub-interpreter-support: diff --git a/Doc/c-api/long.rst b/Doc/c-api/long.rst index b348015..d33d539 100644 --- a/Doc/c-api/long.rst +++ b/Doc/c-api/long.rst @@ -96,14 +96,14 @@ All integers are implemented as "long" integer objects of arbitrary size. .. c:function:: PyObject* PyLong_FromUnicode(Py_UNICODE *u, Py_ssize_t length, int base) - Convert a sequence of Unicode digits to a Python integer value. The Unicode - string is first encoded to a byte string using :c:func:`PyUnicode_EncodeDecimal` - and then converted using :c:func:`PyLong_FromString`. - .. deprecated-removed:: 3.3 4.0 Part of the old-style :c:type:`Py_UNICODE` API; please migrate to using :c:func:`PyLong_FromUnicodeObject`. + Convert a sequence of Unicode digits to a Python integer value. The Unicode + string is first encoded to a byte string using :c:func:`PyUnicode_EncodeDecimal` + and then converted using :c:func:`PyLong_FromString`. + .. c:function:: PyObject* PyLong_FromUnicodeObject(PyObject *u, int base) diff --git a/Doc/c-api/module.rst b/Doc/c-api/module.rst index ef778cc..cc1b237 100644 --- a/Doc/c-api/module.rst +++ b/Doc/c-api/module.rst @@ -111,13 +111,13 @@ Module Objects .. c:function:: char* PyModule_GetFilename(PyObject *module) - Similar to :c:func:`PyModule_GetFilenameObject` but return the filename - encoded to 'utf-8'. - .. deprecated:: 3.2 :c:func:`PyModule_GetFilename` raises :c:type:`UnicodeEncodeError` on unencodable filenames, use :c:func:`PyModule_GetFilenameObject` instead. + Similar to :c:func:`PyModule_GetFilenameObject` but return the filename + encoded to 'utf-8'. + .. _initializing-modules: diff --git a/Doc/c-api/unicode.rst b/Doc/c-api/unicode.rst index 2eeadb5..674cf07 100644 --- a/Doc/c-api/unicode.rst +++ b/Doc/c-api/unicode.rst @@ -226,6 +226,10 @@ access internal read-only data of Unicode objects: .. c:function:: Py_UNICODE* PyUnicode_AS_UNICODE(PyObject *o) const char* PyUnicode_AS_DATA(PyObject *o) + .. deprecated-removed:: 3.3 4.0 + Part of the old-style Unicode API, please migrate to using the + :c:func:`PyUnicode_nBYTE_DATA` family of macros. + Return a pointer to a :c:type:`Py_UNICODE` representation of the object. The returned buffer is always terminated with an extra null code point. It may also contain embedded null code points, which would cause the string @@ -240,10 +244,6 @@ access internal read-only data of Unicode objects: code to use the new :c:func:`PyUnicode_nBYTE_DATA` macros or use :c:func:`PyUnicode_WRITE` or :c:func:`PyUnicode_READ`. - .. deprecated-removed:: 3.3 4.0 - Part of the old-style Unicode API, please migrate to using the - :c:func:`PyUnicode_nBYTE_DATA` family of macros. - Unicode Character Properties """""""""""""""""""""""""""" @@ -319,27 +319,27 @@ These APIs can be used for fast direct character conversions: .. c:function:: Py_UNICODE Py_UNICODE_TOLOWER(Py_UNICODE ch) - Return the character *ch* converted to lower case. - .. deprecated:: 3.3 This function uses simple case mappings. + Return the character *ch* converted to lower case. -.. c:function:: Py_UNICODE Py_UNICODE_TOUPPER(Py_UNICODE ch) - Return the character *ch* converted to upper case. +.. c:function:: Py_UNICODE Py_UNICODE_TOUPPER(Py_UNICODE ch) .. deprecated:: 3.3 This function uses simple case mappings. + Return the character *ch* converted to upper case. -.. c:function:: Py_UNICODE Py_UNICODE_TOTITLE(Py_UNICODE ch) - Return the character *ch* converted to title case. +.. c:function:: Py_UNICODE Py_UNICODE_TOTITLE(Py_UNICODE ch) .. deprecated:: 3.3 This function uses simple case mappings. + Return the character *ch* converted to title case. + .. c:function:: int Py_UNICODE_TODECIMAL(Py_UNICODE ch) @@ -1010,16 +1010,16 @@ These are the generic codec APIs: .. c:function:: PyObject* PyUnicode_Encode(const Py_UNICODE *s, Py_ssize_t size, \ const char *encoding, const char *errors) + .. deprecated-removed:: 3.3 4.0 + Part of the old-style :c:type:`Py_UNICODE` API; please migrate to using + :c:func:`PyUnicode_AsEncodedString`. + Encode the :c:type:`Py_UNICODE` buffer *s* of the given *size* and return a Python bytes object. *encoding* and *errors* have the same meaning as the parameters of the same name in the Unicode :meth:`~str.encode` method. The codec to be used is looked up using the Python codec registry. Return *NULL* if an exception was raised by the codec. - .. deprecated-removed:: 3.3 4.0 - Part of the old-style :c:type:`Py_UNICODE` API; please migrate to using - :c:func:`PyUnicode_AsEncodedString`. - UTF-8 Codecs """""""""""" @@ -1076,14 +1076,14 @@ These are the UTF-8 codec APIs: .. c:function:: PyObject* PyUnicode_EncodeUTF8(const Py_UNICODE *s, Py_ssize_t size, const char *errors) - Encode the :c:type:`Py_UNICODE` buffer *s* of the given *size* using UTF-8 and - return a Python bytes object. Return *NULL* if an exception was raised by - the codec. - .. deprecated-removed:: 3.3 4.0 Part of the old-style :c:type:`Py_UNICODE` API; please migrate to using :c:func:`PyUnicode_AsUTF8String` or :c:func:`PyUnicode_AsUTF8AndSize`. + Encode the :c:type:`Py_UNICODE` buffer *s* of the given *size* using UTF-8 and + return a Python bytes object. Return *NULL* if an exception was raised by + the codec. + UTF-32 Codecs """"""""""""" @@ -1138,6 +1138,10 @@ These are the UTF-32 codec APIs: .. c:function:: PyObject* PyUnicode_EncodeUTF32(const Py_UNICODE *s, Py_ssize_t size, \ const char *errors, int byteorder) + .. deprecated-removed:: 3.3 4.0 + Part of the old-style :c:type:`Py_UNICODE` API; please migrate to using + :c:func:`PyUnicode_AsUTF32String`. + Return a Python bytes object holding the UTF-32 encoded value of the Unicode data in *s*. Output is written according to the following byte order:: @@ -1153,10 +1157,6 @@ These are the UTF-32 codec APIs: Return *NULL* if an exception was raised by the codec. - .. deprecated-removed:: 3.3 4.0 - Part of the old-style :c:type:`Py_UNICODE` API; please migrate to using - :c:func:`PyUnicode_AsUTF32String`. - UTF-16 Codecs """"""""""""" @@ -1212,6 +1212,10 @@ These are the UTF-16 codec APIs: .. c:function:: PyObject* PyUnicode_EncodeUTF16(const Py_UNICODE *s, Py_ssize_t size, \ const char *errors, int byteorder) + .. deprecated-removed:: 3.3 4.0 + Part of the old-style :c:type:`Py_UNICODE` API; please migrate to using + :c:func:`PyUnicode_AsUTF16String`. + Return a Python bytes object holding the UTF-16 encoded value of the Unicode data in *s*. Output is written according to the following byte order:: @@ -1228,10 +1232,6 @@ These are the UTF-16 codec APIs: Return *NULL* if an exception was raised by the codec. - .. deprecated-removed:: 3.3 4.0 - Part of the old-style :c:type:`Py_UNICODE` API; please migrate to using - :c:func:`PyUnicode_AsUTF16String`. - UTF-7 Codecs """""""""""" @@ -1248,6 +1248,9 @@ These are the UTF-7 codec APIs: .. c:function:: PyObject* PyUnicode_DecodeUTF7Stateful(const char *s, Py_ssize_t size, \ const char *errors, Py_ssize_t *consumed) + .. deprecated-removed:: 3.3 4.0 + Part of the old-style :c:type:`Py_UNICODE` API. + If *consumed* is *NULL*, behave like :c:func:`PyUnicode_DecodeUTF7`. If *consumed* is not *NULL*, trailing incomplete UTF-7 base-64 sections will not be treated as an error. Those bytes will not be decoded and the number of @@ -1266,9 +1269,6 @@ These are the UTF-7 codec APIs: nonzero, whitespace will be encoded in base-64. Both are set to zero for the Python "utf-7" codec. - .. deprecated-removed:: 3.3 4.0 - Part of the old-style :c:type:`Py_UNICODE` API. - .. XXX replace with what? @@ -1294,14 +1294,14 @@ These are the "Unicode Escape" codec APIs: .. c:function:: PyObject* PyUnicode_EncodeUnicodeEscape(const Py_UNICODE *s, Py_ssize_t size) - Encode the :c:type:`Py_UNICODE` buffer of the given *size* using Unicode-Escape and - return a Python string object. Return *NULL* if an exception was raised by the - codec. - .. deprecated-removed:: 3.3 4.0 Part of the old-style :c:type:`Py_UNICODE` API; please migrate to using :c:func:`PyUnicode_AsUnicodeEscapeString`. + Encode the :c:type:`Py_UNICODE` buffer of the given *size* using Unicode-Escape and + return a Python string object. Return *NULL* if an exception was raised by the + codec. + Raw-Unicode-Escape Codecs """"""""""""""""""""""""" @@ -1326,14 +1326,14 @@ These are the "Raw Unicode Escape" codec APIs: .. c:function:: PyObject* PyUnicode_EncodeRawUnicodeEscape(const Py_UNICODE *s, \ Py_ssize_t size, const char *errors) - Encode the :c:type:`Py_UNICODE` buffer of the given *size* using Raw-Unicode-Escape - and return a Python string object. Return *NULL* if an exception was raised by - the codec. - .. deprecated-removed:: 3.3 4.0 Part of the old-style :c:type:`Py_UNICODE` API; please migrate to using :c:func:`PyUnicode_AsRawUnicodeEscapeString`. + Encode the :c:type:`Py_UNICODE` buffer of the given *size* using Raw-Unicode-Escape + and return a Python string object. Return *NULL* if an exception was raised by + the codec. + Latin-1 Codecs """""""""""""" @@ -1357,14 +1357,14 @@ ordinals and only these are accepted by the codecs during encoding. .. c:function:: PyObject* PyUnicode_EncodeLatin1(const Py_UNICODE *s, Py_ssize_t size, const char *errors) - Encode the :c:type:`Py_UNICODE` buffer of the given *size* using Latin-1 and - return a Python bytes object. Return *NULL* if an exception was raised by - the codec. - .. deprecated-removed:: 3.3 4.0 Part of the old-style :c:type:`Py_UNICODE` API; please migrate to using :c:func:`PyUnicode_AsLatin1String`. + Encode the :c:type:`Py_UNICODE` buffer of the given *size* using Latin-1 and + return a Python bytes object. Return *NULL* if an exception was raised by + the codec. + ASCII Codecs """""""""""" @@ -1388,14 +1388,14 @@ codes generate errors. .. c:function:: PyObject* PyUnicode_EncodeASCII(const Py_UNICODE *s, Py_ssize_t size, const char *errors) - Encode the :c:type:`Py_UNICODE` buffer of the given *size* using ASCII and - return a Python bytes object. Return *NULL* if an exception was raised by - the codec. - .. deprecated-removed:: 3.3 4.0 Part of the old-style :c:type:`Py_UNICODE` API; please migrate to using :c:func:`PyUnicode_AsASCIIString`. + Encode the :c:type:`Py_UNICODE` buffer of the given *size* using ASCII and + return a Python bytes object. Return *NULL* if an exception was raised by + the codec. + Character Map Codecs """""""""""""""""""" @@ -1446,6 +1446,11 @@ The following codec API is special in that maps Unicode to Unicode. .. c:function:: PyObject* PyUnicode_TranslateCharmap(const Py_UNICODE *s, Py_ssize_t size, \ PyObject *table, const char *errors) + .. deprecated-removed:: 3.3 4.0 + Part of the old-style :c:type:`Py_UNICODE` API. + + .. XXX replace with what? + Translate a :c:type:`Py_UNICODE` buffer of the given *size* by applying a character mapping *table* to it and return the resulting Unicode object. Return *NULL* when an exception was raised by the codec. @@ -1457,23 +1462,18 @@ The following codec API is special in that maps Unicode to Unicode. and sequences work well. Unmapped character ordinals (ones which cause a :exc:`LookupError`) are left untouched and are copied as-is. - .. deprecated-removed:: 3.3 4.0 - Part of the old-style :c:type:`Py_UNICODE` API. - - .. XXX replace with what? - .. c:function:: PyObject* PyUnicode_EncodeCharmap(const Py_UNICODE *s, Py_ssize_t size, \ PyObject *mapping, const char *errors) - Encode the :c:type:`Py_UNICODE` buffer of the given *size* using the given - *mapping* object and return a Python string object. Return *NULL* if an - exception was raised by the codec. - .. deprecated-removed:: 3.3 4.0 Part of the old-style :c:type:`Py_UNICODE` API; please migrate to using :c:func:`PyUnicode_AsCharmapString`. + Encode the :c:type:`Py_UNICODE` buffer of the given *size* using the given + *mapping* object and return a Python string object. Return *NULL* if an + exception was raised by the codec. + MBCS codecs for Windows """"""""""""""""""""""" @@ -1516,14 +1516,14 @@ the user settings on the machine running the codec. .. c:function:: PyObject* PyUnicode_EncodeMBCS(const Py_UNICODE *s, Py_ssize_t size, const char *errors) - Encode the :c:type:`Py_UNICODE` buffer of the given *size* using MBCS and return - a Python bytes object. Return *NULL* if an exception was raised by the - codec. - .. deprecated-removed:: 3.3 4.0 Part of the old-style :c:type:`Py_UNICODE` API; please migrate to using :c:func:`PyUnicode_AsMBCSString` or :c:func:`PyUnicode_EncodeCodePage`. + Encode the :c:type:`Py_UNICODE` buffer of the given *size* using MBCS and return + a Python bytes object. Return *NULL* if an exception was raised by the + codec. + Methods & Slots """"""""""""""" diff --git a/Doc/library/abc.rst b/Doc/library/abc.rst index 7a73704..3ee9a96 100644 --- a/Doc/library/abc.rst +++ b/Doc/library/abc.rst @@ -222,6 +222,10 @@ The :mod:`abc` module also provides the following decorators: .. decorator:: abstractclassmethod + .. deprecated:: 3.3 + It is now possible to use :class:`classmethod` with + :func:`abstractmethod`, making this decorator redundant. + A subclass of the built-in :func:`classmethod`, indicating an abstract classmethod. Otherwise it is similar to :func:`abstractmethod`. @@ -236,13 +240,14 @@ The :mod:`abc` module also provides the following decorators: ... .. versionadded:: 3.2 - .. deprecated:: 3.3 - It is now possible to use :class:`classmethod` with - :func:`abstractmethod`, making this decorator redundant. .. decorator:: abstractstaticmethod + .. deprecated:: 3.3 + It is now possible to use :class:`staticmethod` with + :func:`abstractmethod`, making this decorator redundant. + A subclass of the built-in :func:`staticmethod`, indicating an abstract staticmethod. Otherwise it is similar to :func:`abstractmethod`. @@ -257,13 +262,15 @@ The :mod:`abc` module also provides the following decorators: ... .. versionadded:: 3.2 - .. deprecated:: 3.3 - It is now possible to use :class:`staticmethod` with - :func:`abstractmethod`, making this decorator redundant. .. decorator:: abstractproperty(fget=None, fset=None, fdel=None, doc=None) + .. deprecated:: 3.3 + It is now possible to use :class:`property`, :meth:`property.getter`, + :meth:`property.setter` and :meth:`property.deleter` with + :func:`abstractmethod`, making this decorator redundant. + A subclass of the built-in :func:`property`, indicating an abstract property. @@ -306,12 +313,6 @@ The :mod:`abc` module also provides the following decorators: ... - .. deprecated:: 3.3 - It is now possible to use :class:`property`, :meth:`property.getter`, - :meth:`property.setter` and :meth:`property.deleter` with - :func:`abstractmethod`, making this decorator redundant. - - The :mod:`abc` module also provides the following functions: .. function:: get_cache_token() diff --git a/Doc/library/asyncio-task.rst b/Doc/library/asyncio-task.rst index 08c5873..1182fe1 100644 --- a/Doc/library/asyncio-task.rst +++ b/Doc/library/asyncio-task.rst @@ -545,10 +545,10 @@ Task functions .. function:: async(coro_or_future, \*, loop=None) - A deprecated alias to :func:`ensure_future`. - .. deprecated:: 3.4.4 + A deprecated alias to :func:`ensure_future`. + .. function:: gather(\*coros_or_futures, loop=None, return_exceptions=False) Return a future aggregating results from the given coroutine objects or diff --git a/Doc/library/asyncore.rst b/Doc/library/asyncore.rst index 917d044..2df24d5 100644 --- a/Doc/library/asyncore.rst +++ b/Doc/library/asyncore.rst @@ -150,13 +150,13 @@ any that have been added to the map during asynchronous service) is closed. .. method:: handle_accept() + .. deprecated:: 3.2 + Called on listening channels (passive openers) when a connection can be established with a new remote endpoint that has issued a :meth:`connect` call for the local endpoint. Deprecated in version 3.2; use :meth:`handle_accepted` instead. - .. deprecated:: 3.2 - .. method:: handle_accepted(sock, addr) diff --git a/Doc/library/cgi.rst b/Doc/library/cgi.rst index 7e496ca..28a69ed 100644 --- a/Doc/library/cgi.rst +++ b/Doc/library/cgi.rst @@ -344,6 +344,10 @@ algorithms implemented in this module in other circumstances. .. function:: escape(s, quote=False) + .. deprecated:: 3.2 + This function is unsafe because *quote* is false by default, and therefore + deprecated. Use :func:`html.escape` instead. + Convert the characters ``'&'``, ``'<'`` and ``'>'`` in string *s* to HTML-safe sequences. Use this if you need to display text that might contain such characters in HTML. If the optional flag *quote* is true, the quotation mark @@ -351,10 +355,6 @@ algorithms implemented in this module in other circumstances. attribute value delimited by double quotes, as in ````. Note that single quotes are never translated. - .. deprecated:: 3.2 - This function is unsafe because *quote* is false by default, and therefore - deprecated. Use :func:`html.escape` instead. - .. _cgi-security: diff --git a/Doc/library/fileinput.rst b/Doc/library/fileinput.rst index ee06830..4b8987e 100644 --- a/Doc/library/fileinput.rst +++ b/Doc/library/fileinput.rst @@ -134,6 +134,9 @@ available for subclassing as well: .. class:: FileInput(files=None, inplace=False, backup='', bufsize=0, mode='r', openhook=None) + .. deprecated:: 3.4 + The ``'rU'`` and ``'U'`` modes. + Class :class:`FileInput` is the implementation; its methods :meth:`filename`, :meth:`fileno`, :meth:`lineno`, :meth:`filelineno`, :meth:`isfirstline`, :meth:`isstdin`, :meth:`nextfile` and :meth:`close` correspond to the @@ -160,9 +163,6 @@ available for subclassing as well: .. versionchanged:: 3.2 Can be used as a context manager. - .. deprecated:: 3.4 - The ``'rU'`` and ``'U'`` modes. - **Optional in-place filtering:** if the keyword argument ``inplace=True`` is passed to :func:`fileinput.input` or to the :class:`FileInput` constructor, the diff --git a/Doc/library/fractions.rst b/Doc/library/fractions.rst index d24f80a..3231bc2 100644 --- a/Doc/library/fractions.rst +++ b/Doc/library/fractions.rst @@ -166,15 +166,15 @@ another rational number, or from a string. .. function:: gcd(a, b) + .. deprecated:: 3.5 + Use :func:`math.gcd` instead. + Return the greatest common divisor of the integers *a* and *b*. If either *a* or *b* is nonzero, then the absolute value of ``gcd(a, b)`` is the largest integer that divides both *a* and *b*. ``gcd(a,b)`` has the same sign as *b* if *b* is nonzero; otherwise it takes the sign of *a*. ``gcd(0, 0)`` returns ``0``. - .. deprecated:: 3.5 - Use :func:`math.gcd` instead. - .. seealso:: diff --git a/Doc/library/ftplib.rst b/Doc/library/ftplib.rst index 3b9f50c..343a0af 100644 --- a/Doc/library/ftplib.rst +++ b/Doc/library/ftplib.rst @@ -329,16 +329,18 @@ followed by ``lines`` for the text version or ``binary`` for the binary version. .. method:: FTP.nlst(argument[, ...]) + .. deprecated:: 3.3 use :meth:`mlsd` instead. + Return a list of file names as returned by the ``NLST`` command. The optional *argument* is a directory to list (default is the current server directory). Multiple arguments can be used to pass non-standard options to the ``NLST`` command. - .. deprecated:: 3.3 use :meth:`mlsd` instead. - .. method:: FTP.dir(argument[, ...]) + .. deprecated:: 3.3 use :meth:`mlsd` instead. + Produce a directory listing as returned by the ``LIST`` command, printing it to standard output. The optional *argument* is a directory to list (default is the current server directory). Multiple arguments can be used to pass non-standard @@ -346,8 +348,6 @@ followed by ``lines`` for the text version or ``binary`` for the binary version. as a *callback* function as for :meth:`retrlines`; the default prints to ``sys.stdout``. This method returns ``None``. - .. deprecated:: 3.3 use :meth:`mlsd` instead. - .. method:: FTP.rename(fromname, toname) diff --git a/Doc/library/hmac.rst b/Doc/library/hmac.rst index 1446da6..48e162e 100644 --- a/Doc/library/hmac.rst +++ b/Doc/library/hmac.rst @@ -15,6 +15,9 @@ This module implements the HMAC algorithm as described by :rfc:`2104`. .. function:: new(key, msg=None, digestmod=None) + .. deprecated:: 3.4 + MD5 as implicit default digest for *digestmod* is deprecated. + Return a new hmac object. *key* is a bytes or bytearray object giving the secret key. If *msg* is present, the method call ``update(msg)`` is made. *digestmod* is the digest name, digest constructor or module for the HMAC @@ -26,9 +29,6 @@ This module implements the HMAC algorithm as described by :rfc:`2104`. Parameter *msg* can be of any type supported by :mod:`hashlib`. Parameter *digestmod* can be the name of a hash algorithm. - .. deprecated:: 3.4 - MD5 as implicit default digest for *digestmod* is deprecated. - An HMAC object has the following methods: diff --git a/Doc/library/http.cookies.rst b/Doc/library/http.cookies.rst index c2bb80d..435a59f 100644 --- a/Doc/library/http.cookies.rst +++ b/Doc/library/http.cookies.rst @@ -150,36 +150,36 @@ Morsel Objects .. attribute:: Morsel.value - The value of the cookie. - .. deprecated:: 3.5 assigning to ``value``; use :meth:`~Morsel.set` instead. + The value of the cookie. -.. attribute:: Morsel.coded_value - The encoded value of the cookie --- this is what should be sent. +.. attribute:: Morsel.coded_value .. deprecated:: 3.5 assigning to ``coded_value``; use :meth:`~Morsel.set` instead. + The encoded value of the cookie --- this is what should be sent. -.. attribute:: Morsel.key - The name of the cookie. +.. attribute:: Morsel.key .. deprecated:: 3.5 assigning to ``key``; use :meth:`~Morsel.set` instead. + The name of the cookie. -.. method:: Morsel.set(key, value, coded_value) - Set the *key*, *value* and *coded_value* attributes. +.. method:: Morsel.set(key, value, coded_value) .. deprecated:: 3.5 The undocumented *LegalChars* parameter is ignored and will be removed in a future version. + Set the *key*, *value* and *coded_value* attributes. + .. method:: Morsel.isReservedKey(K) diff --git a/Doc/library/idle.rst b/Doc/library/idle.rst index 4384d56..74abdd2 100644 --- a/Doc/library/idle.rst +++ b/Doc/library/idle.rst @@ -565,6 +565,8 @@ Some consoles only work with a single physical line at a time. Running without a subprocess ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +.. deprecated:: 3.4 + By default, IDLE executes user code in a separate subprocess via a socket, which uses the internal loopback interface. This connection is not externally visible and no data is sent to or received from the Internet. @@ -587,8 +589,6 @@ re-import any specific items (e.g. from foo import baz) if the changes are to take effect. For these reasons, it is preferable to run IDLE with the default subprocess if at all possible. -.. deprecated:: 3.4 - Help and preferences -------------------- diff --git a/Doc/library/imp.rst b/Doc/library/imp.rst index 68a6b68..01e8159 100644 --- a/Doc/library/imp.rst +++ b/Doc/library/imp.rst @@ -18,15 +18,18 @@ This module provides an interface to the mechanisms used to implement the .. index:: pair: file; byte-code - Return the magic string value used to recognize byte-compiled code files - (:file:`.pyc` files). (This value may be different for each Python version.) - .. deprecated:: 3.4 Use :attr:`importlib.util.MAGIC_NUMBER` instead. + Return the magic string value used to recognize byte-compiled code files + (:file:`.pyc` files). (This value may be different for each Python version.) + .. function:: get_suffixes() + .. deprecated:: 3.3 + Use the constants defined on :mod:`importlib.machinery` instead. + Return a list of 3-element tuples, each describing a particular type of module. Each triple has the form ``(suffix, mode, type)``, where *suffix* is a string to be appended to the module name to form the filename to search @@ -36,12 +39,14 @@ This module provides an interface to the mechanisms used to implement the :const:`PY_SOURCE`, :const:`PY_COMPILED`, or :const:`C_EXTENSION`, described below. - .. deprecated:: 3.3 - Use the constants defined on :mod:`importlib.machinery` instead. - .. function:: find_module(name[, path]) + .. deprecated:: 3.3 + Use :func:`importlib.util.find_spec` instead unless Python 3.3 + compatibility is required, in which case use + :func:`importlib.find_loader`. + Try to find the module *name*. If *path* is omitted or ``None``, the list of directory names given by ``sys.path`` is searched, but first a few special places are searched: the function tries to find a built-in module with the @@ -78,14 +83,17 @@ This module provides an interface to the mechanisms used to implement the then use :func:`find_module` with the *path* argument set to ``P.__path__``. When *P* itself has a dotted name, apply this recipe recursively. - .. deprecated:: 3.3 - Use :func:`importlib.util.find_spec` instead unless Python 3.3 - compatibility is required, in which case use - :func:`importlib.find_loader`. - .. function:: load_module(name, file, pathname, description) + .. deprecated:: 3.3 + If previously used in conjunction with :func:`imp.find_module` then + consider using :func:`importlib.import_module`, otherwise use the loader + returned by the replacement you chose for :func:`imp.find_module`. If you + called :func:`imp.load_module` and related functions directly then use the + classes in :mod:`importlib.machinery`, e.g. + ``importlib.machinery.SourceFileLoader(name, path).load_module()``. + Load a module that was previously found by :func:`find_module` (or by an otherwise conducted search yielding compatible results). This function does more than importing the module: if the module was already imported, it will @@ -104,26 +112,21 @@ This module provides an interface to the mechanisms used to implement the it was not ``None``, even when an exception is raised. This is best done using a :keyword:`try` ... :keyword:`finally` statement. - .. deprecated:: 3.3 - If previously used in conjunction with :func:`imp.find_module` then - consider using :func:`importlib.import_module`, otherwise use the loader - returned by the replacement you chose for :func:`imp.find_module`. If you - called :func:`imp.load_module` and related functions directly then use the - classes in :mod:`importlib.machinery`, e.g. - ``importlib.machinery.SourceFileLoader(name, path).load_module()``. - .. function:: new_module(name) - Return a new empty module object called *name*. This object is *not* inserted - in ``sys.modules``. - .. deprecated:: 3.4 Use :class:`types.ModuleType` instead. + Return a new empty module object called *name*. This object is *not* inserted + in ``sys.modules``. + .. function:: reload(module) + .. deprecated:: 3.4 + Use :func:`importlib.reload` instead. + Reload a previously imported *module*. The argument must be a module object, so it must have been successfully imported before. This is useful if you have edited the module source file using an external editor and want to try out the @@ -181,9 +184,6 @@ This module provides an interface to the mechanisms used to implement the Relies on both ``__name__`` and ``__loader__`` being defined on the module being reloaded instead of just ``__name__``. - .. deprecated:: 3.4 - Use :func:`importlib.reload` instead. - The following functions are conveniences for handling :pep:`3147` byte-compiled file paths. @@ -192,6 +192,9 @@ file paths. .. function:: cache_from_source(path, debug_override=None) + .. deprecated:: 3.4 + Use :func:`importlib.util.cache_from_source` instead. + Return the :pep:`3147` path to the byte-compiled file associated with the source *path*. For example, if *path* is ``/foo/bar/baz.py`` the return value would be ``/foo/bar/__pycache__/baz.cpython-32.pyc`` for Python 3.2. @@ -207,15 +210,15 @@ file paths. If :attr:`sys.implementation.cache_tag` is ``None``, then :exc:`NotImplementedError` is raised. - .. deprecated:: 3.4 - Use :func:`importlib.util.cache_from_source` instead. - .. versionchanged:: 3.5 The *debug_override* parameter no longer creates a ``.pyo`` file. .. function:: source_from_cache(path) + .. deprecated:: 3.4 + Use :func:`importlib.util.source_from_cache` instead. + Given the *path* to a :pep:`3147` file name, return the associated source code file path. For example, if *path* is ``/foo/bar/__pycache__/baz.cpython-32.pyc`` the returned path would be @@ -228,19 +231,16 @@ file paths. Raise :exc:`NotImplementedError` when :attr:`sys.implementation.cache_tag` is not defined. - .. deprecated:: 3.4 - Use :func:`importlib.util.source_from_cache` instead. - .. function:: get_tag() - Return the :pep:`3147` magic tag string matching this version of Python's - magic number, as returned by :func:`get_magic`. - .. deprecated:: 3.4 Use :attr:`sys.implementation.cache_tag` directly starting in Python 3.3. + Return the :pep:`3147` magic tag string matching this version of Python's + magic number, as returned by :func:`get_magic`. + The following functions help interact with the import system's internal locking mechanism. Locking semantics of imports are an implementation @@ -250,6 +250,8 @@ that circular imports work without any deadlocks. .. function:: lock_held() + .. deprecated:: 3.4 + Return ``True`` if the global import lock is currently held, else ``False``. On platforms without threads, always return ``False``. @@ -266,11 +268,11 @@ that circular imports work without any deadlocks. the most part. A global import lock is kept for some critical tasks, such as initializing the per-module locks. - .. deprecated:: 3.4 - .. function:: acquire_lock() + .. deprecated:: 3.4 + Acquire the interpreter's global import lock for the current thread. This lock should be used by import hooks to ensure thread-safety when importing modules. @@ -286,11 +288,11 @@ that circular imports work without any deadlocks. the most part. A global import lock is kept for some critical tasks, such as initializing the per-module locks. - .. deprecated:: 3.4 - .. function:: release_lock() + .. deprecated:: 3.4 + Release the interpreter's global import lock. On platforms without threads, this function does nothing. @@ -299,8 +301,6 @@ that circular imports work without any deadlocks. the most part. A global import lock is kept for some critical tasks, such as initializing the per-module locks. - .. deprecated:: 3.4 - The following constants with integer values, defined in this module, are used to indicate the search result of :func:`find_module`. @@ -308,48 +308,51 @@ to indicate the search result of :func:`find_module`. .. data:: PY_SOURCE - The module was found as a source file. - .. deprecated:: 3.3 + The module was found as a source file. -.. data:: PY_COMPILED - The module was found as a compiled code object file. +.. data:: PY_COMPILED .. deprecated:: 3.3 + The module was found as a compiled code object file. -.. data:: C_EXTENSION - The module was found as dynamically loadable shared library. +.. data:: C_EXTENSION .. deprecated:: 3.3 + The module was found as dynamically loadable shared library. -.. data:: PKG_DIRECTORY - The module was found as a package directory. +.. data:: PKG_DIRECTORY .. deprecated:: 3.3 + The module was found as a package directory. -.. data:: C_BUILTIN - The module was found as a built-in module. +.. data:: C_BUILTIN .. deprecated:: 3.3 + The module was found as a built-in module. -.. data:: PY_FROZEN - The module was found as a frozen module. +.. data:: PY_FROZEN .. deprecated:: 3.3 + The module was found as a frozen module. + .. class:: NullImporter(path_string) + .. deprecated:: 3.4 + Insert ``None`` into ``sys.path_importer_cache`` instead. + The :class:`NullImporter` type is a :pep:`302` import hook that handles non-directory path strings by failing to find any modules. Calling this type with an existing directory or empty string raises :exc:`ImportError`. @@ -366,9 +369,6 @@ to indicate the search result of :func:`find_module`. ``None`` is inserted into ``sys.path_importer_cache`` instead of an instance of :class:`NullImporter`. - .. deprecated:: 3.4 - Insert ``None`` into ``sys.path_importer_cache`` instead. - .. _examples-imp: diff --git a/Doc/library/importlib.rst b/Doc/library/importlib.rst index da61353..6a3dd93 100644 --- a/Doc/library/importlib.rst +++ b/Doc/library/importlib.rst @@ -106,6 +106,9 @@ Functions .. function:: find_loader(name, path=None) + .. deprecated:: 3.4 + Use :func:`importlib.util.find_spec` instead. + Find the loader for a module, optionally within the specified *path*. If the module is in :attr:`sys.modules`, then ``sys.modules[name].__loader__`` is returned (unless the loader would be ``None`` or is not set, in which case @@ -123,9 +126,6 @@ Functions If ``__loader__`` is not set, raise :exc:`ValueError`, just like when the attribute is set to ``None``. - .. deprecated:: 3.4 - Use :func:`importlib.util.find_spec` instead. - .. function:: invalidate_caches() Invalidate the internal caches of finders stored at @@ -224,11 +224,11 @@ ABC hierarchy:: .. class:: Finder - - An abstract base class representing a :term:`finder`. - + .. deprecated:: 3.3 Use :class:`MetaPathFinder` or :class:`PathEntryFinder` instead. + + An abstract base class representing a :term:`finder`. .. method:: find_module(fullname, path=None) @@ -271,14 +271,14 @@ ABC hierarchy:: If :meth:`find_spec` is defined, backwards-compatible functionality is provided. + .. deprecated:: 3.4 + Use :meth:`find_spec` instead. + .. versionchanged:: 3.4 Returns ``None`` when called instead of raising :exc:`NotImplementedError`. Can use :meth:`find_spec` to provide functionality. - .. deprecated:: 3.4 - Use :meth:`find_spec` instead. - .. method:: invalidate_caches() An optional method which, when called, should invalidate any internal @@ -312,6 +312,9 @@ ABC hierarchy:: .. method:: find_loader(fullname) + .. deprecated:: 3.4 + Use :meth:`find_spec` instead. + A legacy method for finding a :term:`loader` for the specified module. Returns a 2-tuple of ``(loader, portion)`` where ``portion`` is a sequence of file system locations contributing to part of a namespace @@ -329,17 +332,14 @@ ABC hierarchy:: Returns ``(None, [])`` instead of raising :exc:`NotImplementedError`. Uses :meth:`find_spec` when available to provide functionality. + .. method:: find_module(fullname) + .. deprecated:: 3.4 Use :meth:`find_spec` instead. - .. method:: find_module(fullname) - A concrete implementation of :meth:`Finder.find_module` which is equivalent to ``self.find_loader(fullname)[0]``. - .. deprecated:: 3.4 - Use :meth:`find_spec` instead. - .. method:: invalidate_caches() An optional method which, when called, should invalidate any internal @@ -374,6 +374,13 @@ ABC hierarchy:: .. method:: load_module(fullname) + .. deprecated:: 3.4 + The recommended API for loading a module is :meth:`exec_module` + (and :meth:`create_module`). Loaders should implement + it instead of load_module(). The import machinery takes care of + all the other responsibilities of load_module() when exec_module() + is implemented. + A legacy method for loading a module. If the module cannot be loaded, :exc:`ImportError` is raised, otherwise the loaded module is returned. @@ -425,15 +432,11 @@ ABC hierarchy:: :exc:`NotImplementedError`. Functionality provided when :meth:`exec_module` is available. - .. deprecated:: 3.4 - The recommended API for loading a module is :meth:`exec_module` - (and :meth:`create_module`). Loaders should implement - it instead of load_module(). The import machinery takes care of - all the other responsibilities of load_module() when exec_module() - is implemented. - .. method:: module_repr(module) + .. deprecated:: 3.4 + The import machinery now takes care of this automatically. + A legacy method which when implemented calculates and returns the given module's repr, as a string. The module type's default repr() will use the result of this method as appropriate. @@ -443,9 +446,6 @@ ABC hierarchy:: .. versionchanged:: 3.4 Made optional instead of an abstractmethod. - .. deprecated:: 3.4 - The import machinery now takes care of this automatically. - .. class:: ResourceLoader @@ -534,11 +534,11 @@ ABC hierarchy:: .. method:: load_module(fullname) - Implementation of :meth:`Loader.load_module`. - .. deprecated:: 3.4 use :meth:`exec_module` instead. + Implementation of :meth:`Loader.load_module`. + .. class:: ExecutionLoader @@ -581,11 +581,11 @@ ABC hierarchy:: .. method:: load_module(fullname) - Calls super's ``load_module()``. - .. deprecated:: 3.4 Use :meth:`Loader.exec_module` instead. + Calls super's ``load_module()``. + .. method:: get_filename(fullname) Returns :attr:`path`. @@ -634,14 +634,14 @@ ABC hierarchy:: .. method:: path_mtime(path) - Optional abstract method which returns the modification time for the - specified path. - .. deprecated:: 3.3 This method is deprecated in favour of :meth:`path_stats`. You don't have to implement it, but it is still available for compatibility purposes. Raise :exc:`OSError` if the path cannot be handled. + Optional abstract method which returns the modification time for the + specified path. + .. versionchanged:: 3.4 Raise :exc:`OSError` instead of :exc:`NotImplementedError`. @@ -670,11 +670,11 @@ ABC hierarchy:: .. method:: load_module(fullname) - Concrete implementation of :meth:`Loader.load_module`. - .. deprecated:: 3.4 Use :meth:`exec_module` instead. + Concrete implementation of :meth:`Loader.load_module`. + .. method:: get_source(fullname) Concrete implementation of :meth:`InspectLoader.get_source`. @@ -706,24 +706,24 @@ find and load modules. .. attribute:: DEBUG_BYTECODE_SUFFIXES + .. deprecated:: 3.5 + Use :attr:`BYTECODE_SUFFIXES` instead. + A list of strings representing the file suffixes for non-optimized bytecode modules. .. versionadded:: 3.3 +.. attribute:: OPTIMIZED_BYTECODE_SUFFIXES + .. deprecated:: 3.5 Use :attr:`BYTECODE_SUFFIXES` instead. -.. attribute:: OPTIMIZED_BYTECODE_SUFFIXES - A list of strings representing the file suffixes for optimized bytecode modules. .. versionadded:: 3.3 - .. deprecated:: 3.5 - Use :attr:`BYTECODE_SUFFIXES` instead. - .. attribute:: BYTECODE_SUFFIXES A list of strings representing the recognized file suffixes for bytecode @@ -819,11 +819,11 @@ find and load modules. .. classmethod:: find_module(fullname, path=None) - A legacy wrapper around :meth:`find_spec`. - .. deprecated:: 3.4 Use :meth:`find_spec` instead. + A legacy wrapper around :meth:`find_spec`. + .. classmethod:: invalidate_caches() Calls :meth:`importlib.abc.PathEntryFinder.invalidate_caches` on all @@ -1187,6 +1187,10 @@ an :term:`importer`. .. decorator:: module_for_loader + .. deprecated:: 3.4 + The import machinery now directly performs all the functionality + provided by this function. + A :term:`decorator` for :meth:`importlib.abc.Loader.load_module` to handle selecting the proper module object to load with. The decorated method is expected to have a call @@ -1217,12 +1221,11 @@ an :term:`importer`. Set :attr:`__name__`, :attr:`__loader__` :attr:`__package__` unconditionally to support reloading. - .. deprecated:: 3.4 - The import machinery now directly performs all the functionality - provided by this function. - .. decorator:: set_loader + .. deprecated:: 3.4 + The import machinery takes care of this automatically. + A :term:`decorator` for :meth:`importlib.abc.Loader.load_module` to set the :attr:`__loader__` attribute on the returned module. If the attribute is already set the @@ -1234,17 +1237,14 @@ an :term:`importer`. Set ``__loader__`` if set to ``None``, as if the attribute does not exist. +.. decorator:: set_package + .. deprecated:: 3.4 The import machinery takes care of this automatically. -.. decorator:: set_package - A :term:`decorator` for :meth:`importlib.abc.Loader.load_module` to set the :attr:`__package__` attribute on the returned module. If :attr:`__package__` is set and has a value other than ``None`` it will not be changed. - .. deprecated:: 3.4 - The import machinery takes care of this automatically. - .. function:: spec_from_loader(name, loader, *, origin=None, is_package=None) A factory function for creating a :class:`ModuleSpec` instance based diff --git a/Doc/library/inspect.rst b/Doc/library/inspect.rst index af0422f..68f6a15 100644 --- a/Doc/library/inspect.rst +++ b/Doc/library/inspect.rst @@ -792,6 +792,11 @@ Classes and functions .. function:: getfullargspec(func) + .. deprecated:: 3.5 + Use :func:`signature` and + :ref:`Signature Object `, which provide a + better introspecting API for callables. + Get the names and default values of a Python function's arguments. A :term:`named tuple` is returned: @@ -811,28 +816,28 @@ Classes and functions ``__wrapped__`` attributes and includes the already bound first parameter in the signature output for bound methods. + +.. function:: getargvalues(frame) + .. deprecated:: 3.5 Use :func:`signature` and :ref:`Signature Object `, which provide a better introspecting API for callables. - -.. function:: getargvalues(frame) - Get information about arguments passed into a particular frame. A :term:`named tuple` ``ArgInfo(args, varargs, keywords, locals)`` is returned. *args* is a list of the argument names. *varargs* and *keywords* are the names of the ``*`` and ``**`` arguments or ``None``. *locals* is the locals dictionary of the given frame. + +.. function:: formatargspec(args[, varargs, varkw, defaults, kwonlyargs, kwonlydefaults, annotations[, formatarg, formatvarargs, formatvarkw, formatvalue, formatreturns, formatannotations]]) + .. deprecated:: 3.5 Use :func:`signature` and :ref:`Signature Object `, which provide a better introspecting API for callables. - -.. function:: formatargspec(args[, varargs, varkw, defaults, kwonlyargs, kwonlydefaults, annotations[, formatarg, formatvarargs, formatvarkw, formatvalue, formatreturns, formatannotations]]) - Format a pretty argument spec from the values returned by :func:`getfullargspec`. @@ -852,23 +857,18 @@ Classes and functions >>> formatargspec(*getfullargspec(f)) '(a: int, b: float)' + +.. function:: formatargvalues(args[, varargs, varkw, locals, formatarg, formatvarargs, formatvarkw, formatvalue]) + .. deprecated:: 3.5 Use :func:`signature` and :ref:`Signature Object `, which provide a better introspecting API for callables. - -.. function:: formatargvalues(args[, varargs, varkw, locals, formatarg, formatvarargs, formatvarkw, formatvalue]) - Format a pretty argument spec from the four values returned by :func:`getargvalues`. The format\* arguments are the corresponding optional formatting functions that are called to turn names and values into strings. - .. deprecated:: 3.5 - Use :func:`signature` and - :ref:`Signature Object `, which provide a - better introspecting API for callables. - .. function:: getmro(cls) @@ -880,6 +880,9 @@ Classes and functions .. function:: getcallargs(func, *args, **kwds) + .. deprecated:: 3.5 + Use :meth:`Signature.bind` and :meth:`Signature.bind_partial` instead. + Bind the *args* and *kwds* to the argument names of the Python function or method *func*, as if it was called with them. For bound methods, bind also the first argument (typically named ``self``) to the associated instance. A dict @@ -903,9 +906,6 @@ Classes and functions .. versionadded:: 3.2 - .. deprecated:: 3.5 - Use :meth:`Signature.bind` and :meth:`Signature.bind_partial` instead. - .. function:: getclosurevars(func) diff --git a/Doc/library/nntplib.rst b/Doc/library/nntplib.rst index 3943f2c..538db01 100644 --- a/Doc/library/nntplib.rst +++ b/Doc/library/nntplib.rst @@ -522,13 +522,13 @@ them have been superseded by newer commands in :rfc:`3977`. .. method:: NNTP.xpath(id) + .. deprecated:: 3.3 + The XPATH extension is not actively used. + 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: diff --git a/Doc/library/os.rst b/Doc/library/os.rst index c1193ad..a71722e 100644 --- a/Doc/library/os.rst +++ b/Doc/library/os.rst @@ -2243,6 +2243,8 @@ features: .. function:: stat_float_times([newvalue]) + .. deprecated:: 3.3 + Determine whether :class:`stat_result` represents time stamps as float objects. If *newvalue* is ``True``, future calls to :func:`~os.stat` return floats, if it is ``False``, future calls return ints. If *newvalue* is omitted, return the @@ -2265,8 +2267,6 @@ features: are processed, this application should turn the feature off until the library has been corrected. - .. deprecated:: 3.3 - .. function:: statvfs(path) diff --git a/Doc/library/pkgutil.rst b/Doc/library/pkgutil.rst index 5d3295d..1f60365 100644 --- a/Doc/library/pkgutil.rst +++ b/Doc/library/pkgutil.rst @@ -46,6 +46,10 @@ support. .. class:: ImpImporter(dirname=None) + .. deprecated:: 3.3 + This emulation is no longer needed, as the standard import mechanism + is now fully PEP 302 compliant and available in :mod:`importlib`. + :pep:`302` Importer that wraps Python's "classic" import algorithm. If *dirname* is a string, a :pep:`302` importer is created that searches that @@ -56,19 +60,15 @@ support. Note that :class:`ImpImporter` does not currently support being used by placement on :data:`sys.meta_path`. - .. deprecated:: 3.3 - This emulation is no longer needed, as the standard import mechanism - is now fully PEP 302 compliant and available in :mod:`importlib`. - .. class:: ImpLoader(fullname, file, filename, etc) - :pep:`302` Loader that wraps Python's "classic" import algorithm. - .. deprecated:: 3.3 This emulation is no longer needed, as the standard import mechanism is now fully PEP 302 compliant and available in :mod:`importlib`. + :pep:`302` Loader that wraps Python's "classic" import algorithm. + .. function:: find_loader(fullname) diff --git a/Doc/library/platform.rst b/Doc/library/platform.rst index e679317..5faac75 100644 --- a/Doc/library/platform.rst +++ b/Doc/library/platform.rst @@ -216,14 +216,14 @@ Win95/98 specific .. function:: popen(cmd, mode='r', bufsize=-1) - Portable :func:`popen` interface. Find a working popen implementation - preferring :func:`win32pipe.popen`. On Windows NT, :func:`win32pipe.popen` - should work; on Windows 9x it hangs due to bugs in the MS C library. - .. deprecated:: 3.3 This function is obsolete. Use the :mod:`subprocess` module. Check especially the :ref:`subprocess-replacements` section. + Portable :func:`popen` interface. Find a working popen implementation + preferring :func:`win32pipe.popen`. On Windows NT, :func:`win32pipe.popen` + should work; on Windows 9x it hangs due to bugs in the MS C library. + Mac OS Platform --------------- @@ -245,12 +245,14 @@ Unix Platforms .. function:: dist(distname='', version='', id='', supported_dists=('SuSE','debian','redhat','mandrake',...)) - This is another name for :func:`linux_distribution`. - .. deprecated-removed:: 3.5 3.7 + This is another name for :func:`linux_distribution`. + .. function:: linux_distribution(distname='', version='', id='', supported_dists=('SuSE','debian','redhat','mandrake',...), full_distribution_name=1) + .. deprecated-removed:: 3.5 3.7 + Tries to determine the name of the Linux OS distribution name. ``supported_dists`` may be given to define the set of Linux distributions to @@ -265,8 +267,6 @@ Unix Platforms parameters. ``id`` is the item in parentheses after the version number. It is usually the version codename. - .. deprecated-removed:: 3.5 3.7 - .. function:: libc_ver(executable=sys.executable, lib='', version='', chunksize=2048) Tries to determine the libc version against which the file executable (defaults diff --git a/Doc/library/plistlib.rst b/Doc/library/plistlib.rst index 2c1f3dd..24d9072 100644 --- a/Doc/library/plistlib.rst +++ b/Doc/library/plistlib.rst @@ -125,6 +125,8 @@ The following functions are deprecated: .. function:: readPlist(pathOrFile) + .. deprecated:: 3.4 Use :func:`load` instead. + Read a plist file. *pathOrFile* may be either a file name or a (readable and binary) file object. Returns the unpacked root object (which usually is a dictionary). @@ -138,19 +140,19 @@ The following functions are deprecated: to ``__getitem_``. This means that you can use attribute access to access items of these dictionaries. - .. deprecated:: 3.4 Use :func:`load` instead. - .. function:: writePlist(rootObject, pathOrFile) + .. deprecated:: 3.4 Use :func:`dump` instead. + Write *rootObject* to an XML plist file. *pathOrFile* may be either a file name or a (writable and binary) file object - .. deprecated:: 3.4 Use :func:`dump` instead. - .. function:: readPlistFromBytes(data) + .. deprecated:: 3.4 Use :func:`loads` instead. + Read a plist data from a bytes object. Return the root object. See :func:`load` for a description of the keyword arguments. @@ -161,20 +163,20 @@ The following functions are deprecated: to ``__getitem_``. This means that you can use attribute access to access items of these dictionaries. - .. deprecated:: 3.4 Use :func:`loads` instead. - .. function:: writePlistToBytes(rootObject) - Return *rootObject* as an XML plist-formatted bytes object. - .. deprecated:: 3.4 Use :func:`dumps` instead. + Return *rootObject* as an XML plist-formatted bytes object. + The following classes are available: .. class:: Dict([dict]): + .. deprecated:: 3.0 + Return an extended mapping object with the same value as dictionary *dict*. @@ -182,11 +184,11 @@ The following classes are available: be used to access items. That is, ``aDict.key`` is the same as ``aDict['key']`` for getting, setting and deleting items in the mapping. - .. deprecated:: 3.0 - .. class:: Data(data) + .. deprecated:: 3.4 Use a :class:`bytes` object instead. + Return a "data" wrapper object around the bytes object *data*. This is used in functions converting from/to plists to represent the ```` type available in plists. @@ -194,8 +196,6 @@ The following classes are available: It has one attribute, :attr:`data`, that can be used to retrieve the Python bytes object stored in it. - .. deprecated:: 3.4 Use a :class:`bytes` object instead. - The following constants are available: diff --git a/Doc/library/re.rst b/Doc/library/re.rst index 8884584..7388c30 100644 --- a/Doc/library/re.rst +++ b/Doc/library/re.rst @@ -320,6 +320,10 @@ The special sequences consist of ``'\'`` and a character from the list below. If the ordinary character is not on the list, then the resulting RE will match the second character. For example, ``\$`` matches the character ``'$'``. +.. deprecated-removed:: 3.5 3.6 + Unknown escapes consist of ``'\'`` and ASCII letter now raise a + deprecation warning and will be forbidden in Python 3.6. + ``\number`` Matches the contents of the group of the same number. Groups are numbered starting from 1. For example, ``(.+) \1`` matches ``'the the'`` or ``'55 55'``, @@ -438,10 +442,6 @@ three digits in length. .. versionchanged:: 3.3 The ``'\u'`` and ``'\U'`` escape sequences have been added. -.. deprecated-removed:: 3.5 3.6 - Unknown escapes consist of ``'\'`` and ASCII letter now raise a - deprecation warning and will be forbidden in Python 3.6. - .. seealso:: @@ -524,16 +524,16 @@ form. .. data:: L LOCALE + .. deprecated-removed:: 3.5 3.6 + Deprecated the use of :const:`re.LOCALE` with string patterns or + :const:`re.ASCII`. + Make ``\w``, ``\W``, ``\b``, ``\B``, ``\s`` and ``\S`` dependent on the current locale. The use of this flag is discouraged as the locale mechanism is very unreliable, and it only handles one "culture" at a time anyway; you should use Unicode matching instead, which is the default in Python 3 for Unicode (str) patterns. This flag makes sense only with bytes patterns. - .. deprecated-removed:: 3.5 3.6 - Deprecated the use of :const:`re.LOCALE` with string patterns or - :const:`re.ASCII`. - .. data:: M MULTILINE @@ -686,6 +686,10 @@ form. .. function:: sub(pattern, repl, string, count=0, flags=0) + .. deprecated-removed:: 3.5 3.6 + Unknown escapes consist of ``'\'`` and ASCII letter now raise a + deprecation warning and will be forbidden in Python 3.6. + Return the string obtained by replacing the leftmost non-overlapping occurrences of *pattern* in *string* by the replacement *repl*. If the pattern isn't found, *string* is returned unchanged. *repl* can be a string or a function; if it is @@ -736,11 +740,6 @@ form. .. versionchanged:: 3.5 Unmatched groups are replaced with an empty string. - .. deprecated-removed:: 3.5 3.6 - Unknown escapes consist of ``'\'`` and ASCII letter now raise a - deprecation warning and will be forbidden in Python 3.6. - - .. function:: subn(pattern, repl, string, count=0, flags=0) Perform the same operation as :func:`sub`, but return a tuple ``(new_string, diff --git a/Doc/library/string.rst b/Doc/library/string.rst index 2bd8dfd..c65646c 100644 --- a/Doc/library/string.rst +++ b/Doc/library/string.rst @@ -91,14 +91,14 @@ implementation as the built-in :meth:`format` method. .. method:: format(format_string, *args, **kwargs) - :meth:`format` is the primary API method. It takes a format string and - an arbitrary set of positional and keyword arguments. - :meth:`format` is just a wrapper that calls :meth:`vformat`. - .. deprecated:: 3.5 Passing a format string as keyword argument *format_string* has been deprecated. + :meth:`format` is the primary API method. It takes a format string and + an arbitrary set of positional and keyword arguments. + :meth:`format` is just a wrapper that calls :meth:`vformat`. + .. method:: vformat(format_string, args, kwargs) This function does the actual work of formatting. It is exposed as a diff --git a/Doc/library/subprocess.rst b/Doc/library/subprocess.rst index adf99ec..a679213 100644 --- a/Doc/library/subprocess.rst +++ b/Doc/library/subprocess.rst @@ -558,6 +558,8 @@ Instances of the :class:`Popen` class have the following methods: .. method:: Popen.wait(timeout=None) + .. deprecated:: 3.4 + Wait for child process to terminate. Set and return :attr:`~Popen.returncode` attribute. @@ -581,8 +583,6 @@ Instances of the :class:`Popen` class have the following methods: .. versionchanged:: 3.3 *timeout* was added. - .. deprecated:: 3.4 - Do not use the *endtime* parameter. It is was unintentionally exposed in 3.3 but was left undocumented as it was intended to be private for internal use. Use *timeout* instead. diff --git a/Doc/library/sys.rst b/Doc/library/sys.rst index f6325cc..dcb619a 100644 --- a/Doc/library/sys.rst +++ b/Doc/library/sys.rst @@ -400,11 +400,11 @@ always available. .. function:: getcheckinterval() - Return the interpreter's "check interval"; see :func:`setcheckinterval`. - .. deprecated:: 3.2 Use :func:`getswitchinterval` instead. + Return the interpreter's "check interval"; see :func:`setcheckinterval`. + .. function:: getdefaultencoding() @@ -922,6 +922,11 @@ always available. .. function:: setcheckinterval(interval) + .. deprecated:: 3.2 + This function doesn't have an effect anymore, as the internal logic for + thread switching and asynchronous tasks has been rewritten. Use + :func:`setswitchinterval` instead. + Set the interpreter's "check interval". This integer value determines how often the interpreter checks for periodic things such as thread switches and signal handlers. The default is ``100``, meaning the check is performed every 100 @@ -929,11 +934,6 @@ always available. performance for programs using threads. Setting it to a value ``<=`` 0 checks every virtual instruction, maximizing responsiveness as well as overhead. - .. deprecated:: 3.2 - This function doesn't have an effect anymore, as the internal logic for - thread switching and asynchronous tasks has been rewritten. Use - :func:`setswitchinterval` instead. - .. function:: setdlopenflags(n) diff --git a/Doc/library/tarfile.rst b/Doc/library/tarfile.rst index adacb0a..26736c6 100644 --- a/Doc/library/tarfile.rst +++ b/Doc/library/tarfile.rst @@ -432,6 +432,10 @@ be finalized; only the internally used file object will be closed. See the .. method:: TarFile.add(name, arcname=None, recursive=True, exclude=None, *, filter=None) + .. deprecated:: 3.2 + The *exclude* parameter is deprecated, please use the *filter* parameter + instead. + 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 @@ -448,10 +452,6 @@ be finalized; only the internally used file object will be closed. See the .. versionchanged:: 3.2 Added the *filter* parameter. - .. deprecated:: 3.2 - The *exclude* parameter is deprecated, please use the *filter* parameter - instead. - .. method:: TarFile.addfile(tarinfo, fileobj=None) diff --git a/Doc/library/time.rst b/Doc/library/time.rst index 73436ca..bbe6786 100644 --- a/Doc/library/time.rst +++ b/Doc/library/time.rst @@ -126,6 +126,11 @@ The module defines the following functions and data items: .. function:: clock() + .. deprecated:: 3.3 + The behaviour of this function depends on the platform: use + :func:`perf_counter` or :func:`process_time` instead, depending on your + requirements, to have a well defined behaviour. + .. index:: single: CPU time single: processor time @@ -140,11 +145,6 @@ The module defines the following functions and data items: :c:func:`QueryPerformanceCounter`. The resolution is typically better than one microsecond. - .. deprecated:: 3.3 - The behaviour of this function depends on the platform: use - :func:`perf_counter` or :func:`process_time` instead, depending on your - requirements, to have a well defined behaviour. - .. function:: clock_getres(clk_id) diff --git a/Doc/library/turtle.rst b/Doc/library/turtle.rst index 30dd6ef..b755bd9 100644 --- a/Doc/library/turtle.rst +++ b/Doc/library/turtle.rst @@ -1216,6 +1216,8 @@ Appearance .. function:: settiltangle(angle) + .. deprecated:: 3.1 + :param angle: a number Rotate the turtleshape to point in the direction specified by *angle*, @@ -1232,8 +1234,6 @@ Appearance >>> turtle.settiltangle(-45) >>> turtle.fd(50) - .. deprecated:: 3.1 - .. function:: tiltangle(angle=None) diff --git a/Doc/library/xml.etree.elementtree.rst b/Doc/library/xml.etree.elementtree.rst index dc0274e..ad7e74b 100644 --- a/Doc/library/xml.etree.elementtree.rst +++ b/Doc/library/xml.etree.elementtree.rst @@ -504,6 +504,9 @@ Functions .. function:: iterparse(source, events=None, parser=None) + .. deprecated:: 3.4 + The *parser* argument. + Parses an XML section into an element tree incrementally, and reports what's going on to the user. *source* is a filename or :term:`file object` containing XML data. *events* is a sequence of events to report back. The @@ -530,9 +533,6 @@ Functions If you need a fully populated element, look for "end" events instead. - .. deprecated:: 3.4 - The *parser* argument. - .. function:: parse(source, parser=None) Parses an XML section into an element tree. *source* is a filename or file @@ -1042,6 +1042,10 @@ XMLParser Objects .. class:: XMLParser(html=0, target=None, encoding=None) + .. deprecated:: 3.4 + The *html* argument. The remaining arguments should be passed via + keywword to prepare for the removal of the *html* argument. + This class is the low-level building block of the module. It uses :mod:`xml.parsers.expat` for efficient, event-based parsing of XML. It can be fed XML data incrementall with the :meth:`feed` method, and parsing events @@ -1051,10 +1055,6 @@ XMLParser Objects deprecated. If *encoding* [1]_ is given, the value overrides the encoding specified in the XML file. - .. deprecated:: 3.4 - The *html* argument. The remaining arguments should be passed via - keywword to prepare for the removal of the *html* argument. - .. method:: close() Finishes feeding data to the parser. Returns the result of calling the diff --git a/Doc/library/zipfile.rst b/Doc/library/zipfile.rst index d40315e..a8b7ebe 100644 --- a/Doc/library/zipfile.rst +++ b/Doc/library/zipfile.rst @@ -34,10 +34,10 @@ The module defines the following items: .. exception:: BadZipfile - Alias of :exc:`BadZipFile`, for compatibility with older Python versions. - .. deprecated:: 3.2 + Alias of :exc:`BadZipFile`, for compatibility with older Python versions. + .. exception:: LargeZipFile @@ -210,6 +210,10 @@ ZipFile Objects .. method:: ZipFile.open(name, mode='r', pwd=None) + .. deprecated-removed:: 3.4 3.6 + The ``'U'`` or ``'rU'`` mode. Use :class:`io.TextIOWrapper` for reading + compressed text files in :term:`universal newlines` mode. + Extract a member from the archive as a file-like object (ZipExtFile). *name* is the name of the file in the archive, or a :class:`ZipInfo` object. The *mode* parameter, if included, must be one of the following: ``'r'`` (the @@ -243,9 +247,6 @@ ZipFile Objects or a :class:`ZipInfo` object. You will appreciate this when trying to read a ZIP file that contains members with duplicate names. - .. deprecated-removed:: 3.4 3.6 - The ``'U'`` or ``'rU'`` mode. Use :class:`io.TextIOWrapper` for reading - compressed text files in :term:`universal newlines` mode. .. method:: ZipFile.extract(member, path=None, pwd=None) -- 2.2.1