Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions Doc/deprecations/pending-removal-in-3.21.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
Pending removal in Python 3.21
------------------------------

* :mod:`abc`

* Soft-deprecated since Python 3.3 :class:`abc.abstractclassmethod`,
:class:`abc.abstractstaticmethod`, and :class:`abc.abstractproperty`
now raise a :exc:`DeprecationWarning`.
These classes will be removed in Python 3.21, instead
use :func:`abc.abstractmethod` with :func:`classmethod`,
:func:`staticmethod`, and :class:`property` respectively.

* :mod:`ast`:

* Classes ``slice``, ``Index``, ``ExtSlice``, ``Suite``, ``Param``,
Expand Down
6 changes: 3 additions & 3 deletions Doc/library/abc.rst
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ The :mod:`!abc` module also supports the following legacy decorators:
.. decorator:: abstractclassmethod

.. versionadded:: 3.2
.. deprecated:: 3.3
.. deprecated-removed:: 3.3 3.21
It is now possible to use :class:`classmethod` with
:func:`abstractmethod`, making this decorator redundant.

Expand All @@ -258,7 +258,7 @@ The :mod:`!abc` module also supports the following legacy decorators:
.. decorator:: abstractstaticmethod

.. versionadded:: 3.2
.. deprecated:: 3.3
.. deprecated-removed:: 3.3 3.21
It is now possible to use :class:`staticmethod` with
:func:`abstractmethod`, making this decorator redundant.

Expand All @@ -278,7 +278,7 @@ The :mod:`!abc` module also supports the following legacy decorators:

.. decorator:: abstractproperty

.. deprecated:: 3.3
.. deprecated-removed:: 3.3 3.21
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.
Expand Down
32 changes: 16 additions & 16 deletions Doc/library/gettext.rst
Original file line number Diff line number Diff line change
Expand Up @@ -51,19 +51,19 @@ class-based API instead.


.. index:: single: _ (underscore); gettext
.. function:: gettext(message)
.. function:: gettext(message, /)

Return the localized translation of *message*, based on the current global
domain, language, and locale directory. This function is usually aliased as
:func:`!_` in the local namespace (see examples below).


.. function:: dgettext(domain, message)
.. function:: dgettext(domain, message, /)

Like :func:`.gettext`, but look the message up in the specified *domain*.


.. function:: ngettext(singular, plural, n)
.. function:: ngettext(singular, plural, n, /)

Like :func:`.gettext`, but consider plural forms. If a translation is found,
apply the plural formula to *n*, and return the resulting message (some
Expand All @@ -78,15 +78,15 @@ class-based API instead.
formulas for a variety of languages.


.. function:: dngettext(domain, singular, plural, n)
.. function:: dngettext(domain, singular, plural, n, /)

Like :func:`ngettext`, but look the message up in the specified *domain*.


.. function:: pgettext(context, message)
.. function:: dpgettext(domain, context, message)
.. function:: npgettext(context, singular, plural, n)
.. function:: dnpgettext(domain, context, singular, plural, n)
.. function:: pgettext(context, message, /)
.. function:: dpgettext(domain, context, message, /)
.. function:: npgettext(context, singular, plural, n, /)
.. function:: dnpgettext(domain, context, singular, plural, n, /)

Similar to the corresponding functions without the ``p`` in the prefix (that
is, :func:`gettext`, :func:`dgettext`, :func:`ngettext`, :func:`dngettext`),
Expand Down Expand Up @@ -223,28 +223,28 @@ are the methods of :class:`!NullTranslations`:
translation for a given message.


.. method:: gettext(message)
.. method:: gettext(message, /)

If a fallback has been set, forward :meth:`!gettext` to the fallback.
Otherwise, return *message*. Overridden in derived classes.


.. method:: ngettext(singular, plural, n)
.. method:: ngettext(singular, plural, n, /)

If a fallback has been set, forward :meth:`!ngettext` to the fallback.
Otherwise, return *singular* if *n* is 1; return *plural* otherwise.
Overridden in derived classes.


.. method:: pgettext(context, message)
.. method:: pgettext(context, message, /)

If a fallback has been set, forward :meth:`pgettext` to the fallback.
Otherwise, return the translated message. Overridden in derived classes.

.. versionadded:: 3.8


.. method:: npgettext(context, singular, plural, n)
.. method:: npgettext(context, singular, plural, n, /)

If a fallback has been set, forward :meth:`npgettext` to the fallback.
Otherwise, return the translated message. Overridden in derived classes.
Expand Down Expand Up @@ -322,7 +322,7 @@ unexpected, or if other problems occur while reading the file, instantiating a

The following methods are overridden from the base class implementation:

.. method:: gettext(message)
.. method:: gettext(message, /)

Look up the *message* id in the catalog and return the corresponding message
string, as a Unicode string. If there is no entry in the catalog for the
Expand All @@ -331,7 +331,7 @@ unexpected, or if other problems occur while reading the file, instantiating a
*message* id is returned.


.. method:: ngettext(singular, plural, n)
.. method:: ngettext(singular, plural, n, /)

Do a plural-forms lookup of a message id. *singular* is used as the message id
for purposes of lookup in the catalog, while *n* is used to determine which
Expand All @@ -352,7 +352,7 @@ unexpected, or if other problems occur while reading the file, instantiating a
n) % {'num': n}


.. method:: pgettext(context, message)
.. method:: pgettext(context, message, /)

Look up the *context* and *message* id in the catalog and return the
corresponding message string, as a Unicode string. If there is no
Expand All @@ -363,7 +363,7 @@ unexpected, or if other problems occur while reading the file, instantiating a
.. versionadded:: 3.8


.. method:: npgettext(context, singular, plural, n)
.. method:: npgettext(context, singular, plural, n, /)

Do a plural-forms lookup of a message id. *singular* is used as the
message id for purposes of lookup in the catalog, while *n* is used to
Expand Down
10 changes: 6 additions & 4 deletions Doc/library/math.rst
Original file line number Diff line number Diff line change
Expand Up @@ -255,10 +255,12 @@ Floating point manipulation functions

.. function:: frexp(x)

Return the mantissa and exponent of *x* as the pair ``(m, e)``. *m* is a float
and *e* is an integer such that ``x == m * 2**e`` exactly. If *x* is zero,
returns ``(0.0, 0)``, otherwise ``0.5 <= abs(m) < 1``. This is used to "pick
apart" the internal representation of a float in a portable way.
Return the mantissa and exponent of *x* as the pair ``(m, e)``.
If *x* is a finite nonzero number, then *m* is a float with
``0.5 <= abs(m) < 1.0`` and an integer *e* is such that
``x == m * 2**e`` exactly. Else, return ``(x, 0)``.
This is used to "pick apart" the internal representation of
a float in a portable way.

Note that :func:`frexp` has a different call/return pattern
than its C equivalents: it takes a single argument and return a pair of
Expand Down
7 changes: 4 additions & 3 deletions Doc/library/mimetypes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ it converts file extensions to MIME types.

For each ``type`` entry, the script writes a line into the standard output
stream. If an unknown type occurs, it writes an error message into the
standard error stream and exits with the return code ``1``.
standard output stream and exits with the return code ``1``.


.. mimetypes-cli-example:
Expand All @@ -385,7 +385,7 @@ interface:

$ # get a MIME type for a rare file extension
$ python -m mimetypes filename.pict
error: unknown extension of filename.pict
error: media type unknown for filename.pict

$ # now look in the extended database built into Python
$ python -m mimetypes --lenient filename.pict
Expand All @@ -407,7 +407,8 @@ interface:
$ python -m mimetypes filename.sh filename.nc filename.xxx filename.txt
type: application/x-sh encoding: None
type: application/x-netcdf encoding: None
error: unknown extension of filename.xxx
error: media type unknown for filename.xxx
type: text/plain encoding: None

$ # try to feed an unknown MIME type
$ python -m mimetypes --extension audio/aac audio/opus audio/future audio/x-wav
Expand Down
5 changes: 4 additions & 1 deletion Doc/library/multiprocessing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1723,7 +1723,10 @@ inherited by child processes.
Note that *lock* is a keyword only argument.

Note that an array of :data:`ctypes.c_char` has *value* and *raw*
attributes which allow one to use it to store and retrieve strings.
attributes which can both be used to store and retrieve byte strings.
While *raw* allows interaction with a :class:`bytes` object the full size of
the array, reading *value* will terminate after a null byte, like most
programming languages handle strings.


The :mod:`!multiprocessing.sharedctypes` module
Expand Down
2 changes: 2 additions & 0 deletions Doc/whatsnew/3.12.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1367,6 +1367,8 @@ Deprecated

.. include:: ../deprecations/pending-removal-in-3.20.rst

.. include:: ../deprecations/pending-removal-in-3.21.rst

.. include:: ../deprecations/pending-removal-in-future.rst

.. _whatsnew312-removed:
Expand Down
2 changes: 2 additions & 0 deletions Doc/whatsnew/3.13.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2031,6 +2031,8 @@ New Deprecations

.. include:: ../deprecations/pending-removal-in-3.20.rst

.. include:: ../deprecations/pending-removal-in-3.21.rst

.. include:: ../deprecations/pending-removal-in-future.rst

CPython Bytecode Changes
Expand Down
2 changes: 2 additions & 0 deletions Doc/whatsnew/3.14.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2748,6 +2748,8 @@ New deprecations

.. include:: ../deprecations/pending-removal-in-3.20.rst

.. include:: ../deprecations/pending-removal-in-3.21.rst

.. include:: ../deprecations/pending-removal-in-future.rst


Expand Down
2 changes: 2 additions & 0 deletions Doc/whatsnew/3.15.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2335,6 +2335,8 @@ New deprecations

.. include:: ../deprecations/pending-removal-in-3.20.rst

.. include:: ../deprecations/pending-removal-in-3.21.rst

.. include:: ../deprecations/pending-removal-in-future.rst

.. include:: ../deprecations/soft-deprecations.rst
Expand Down
17 changes: 17 additions & 0 deletions Doc/whatsnew/3.16.rst
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,15 @@ tarfile
Deprecated
==========

* :mod:`abc`

* Soft-deprecated since Python 3.3 :class:`abc.abstractclassmethod`,
:class:`abc.abstractstaticmethod`, and :class:`abc.abstractproperty`
now raise a :exc:`DeprecationWarning`.
These classes will be removed in Python 3.21, instead
use :func:`abc.abstractmethod` with :func:`classmethod`,
:func:`staticmethod`, and :class:`property` respectively.

* :mod:`ast`:

* Classes ``slice``, ``Index``, ``ExtSlice``, ``Suite``, ``Param``,
Expand All @@ -228,6 +237,14 @@ Deprecated

.. Add deprecations above alphabetically, not here at the end.

.. include:: ../deprecations/pending-removal-in-3.17.rst

.. include:: ../deprecations/pending-removal-in-3.19.rst

.. include:: ../deprecations/pending-removal-in-3.20.rst

.. include:: ../deprecations/pending-removal-in-future.rst


Porting to Python 3.16
======================
Expand Down
21 changes: 21 additions & 0 deletions Lib/abc.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,15 @@ class C(ABC):
def my_abstract_classmethod(cls, ...):
...

.. deprecated-removed: 3.3 3.21

"""

__isabstractmethod__ = True

def __init__(self, callable):
import warnings
warnings._deprecated('abc.abstractclassmethod', remove=(3, 21))
callable.__isabstractmethod__ = True
super().__init__(callable)

Expand All @@ -56,11 +60,15 @@ class C(ABC):
def my_abstract_staticmethod(...):
...

.. deprecated-removed: 3.3 3.21

"""

__isabstractmethod__ = True

def __init__(self, callable):
import warnings
warnings._deprecated('abc.abstractstaticmethod', remove=(3, 21))
callable.__isabstractmethod__ = True
super().__init__(callable)

Expand All @@ -76,10 +84,23 @@ class C(ABC):
def my_abstract_property(self):
...

.. deprecated-removed: 3.3 3.21

"""

__isabstractmethod__ = True

def __init__(
self,
fget=None,
fset=None,
fdel=None,
doc=None,
):
import warnings
warnings._deprecated('abc.abstractproperty', remove=(3, 21))
super().__init__(fget, fset, fdel, doc)


try:
from _abc import (get_cache_token, _abc_init, _abc_register,
Expand Down
Loading
Loading