Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GH-109975: Copyedit 3.13 What's New: New Deprecations #123845

Merged
merged 3 commits into from
Sep 16, 2024
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
107 changes: 59 additions & 48 deletions Doc/deprecations/pending-removal-in-3.15.rst
Original file line number Diff line number Diff line change
@@ -1,57 +1,68 @@
Pending Removal in Python 3.15
------------------------------

* :class:`http.server.CGIHTTPRequestHandler` will be removed along with its
related ``--cgi`` flag to ``python -m http.server``. It was obsolete and
rarely used. No direct replacement exists. *Anything* is better than CGI
to interface a web server with a request handler.

* :class:`locale`: :func:`locale.getdefaultlocale` was deprecated in Python 3.11
and originally planned for removal in Python 3.13 (:gh:`90817`),
but removal has been postponed to Python 3.15.
Use :func:`locale.setlocale`, :func:`locale.getencoding` and
:func:`locale.getlocale` instead.
(Contributed by Hugo van Kemenade in :gh:`111187`.)
* :mod:`ctypes`:

* The undocumented :func:`!ctypes.SetPointerType` function
has been deprecated since Python 3.13.

* :mod:`http.server`:

* The obsolete and rarely used :class:`~http.server.CGIHTTPRequestHandler`
has been deprecated since Python 3.13.
No direct replacement exists.
*Anything* is better than CGI to interface
a web server with a request handler.

* The :option:`!--cgi` flag to the :program:`python -m http.server`
command-line interface has been deprecated since Python 3.13.

* :class:`locale`:

* The :func:`~locale.getdefaultlocale` function
has been deprecated since Python 3.11.
Its removal was originally planned for Python 3.13 (:gh:`90817`),
but has been postponed to Python 3.15.
Use :func:`~locale.getlocale`, :func:`~locale.setlocale`,
and :func:`~locale.getencoding` instead.
(Contributed by Hugo van Kemenade in :gh:`111187`.)

* :mod:`pathlib`:
:meth:`pathlib.PurePath.is_reserved` is deprecated and scheduled for
removal in Python 3.15. Use :func:`os.path.isreserved` to detect reserved
paths on Windows.

* :meth:`.PurePath.is_reserved`
has been deprecated since Python 3.13.
Use :func:`os.path.isreserved` to detect reserved paths on Windows.

* :mod:`platform`:
:func:`~platform.java_ver` is deprecated and will be removed in 3.15.
It was largely untested, had a confusing API,
and was only useful for Jython support.
(Contributed by Nikita Sobolev in :gh:`116349`.)

* :func:`~platform.java_ver` has been deprecated since Python 3.13.
This function is only useful for Jython support, has a confusing API,
and is largely untested.

* :mod:`threading`:
Passing any arguments to :func:`threading.RLock` is now deprecated.
C version allows any numbers of args and kwargs,
but they are just ignored. Python version does not allow any arguments.
All arguments will be removed from :func:`threading.RLock` in Python 3.15.
(Contributed by Nikita Sobolev in :gh:`102029`.)

* :class:`typing.NamedTuple`:

* The undocumented keyword argument syntax for creating :class:`!NamedTuple` classes
(``NT = NamedTuple("NT", x=int)``) is deprecated, and will be disallowed in
3.15. Use the class-based syntax or the functional syntax instead.

* When using the functional syntax to create a :class:`!NamedTuple` class, failing to
pass a value to the *fields* parameter (``NT = NamedTuple("NT")``) is
deprecated. Passing ``None`` to the *fields* parameter
(``NT = NamedTuple("NT", None)``) is also deprecated. Both will be
disallowed in Python 3.15. To create a :class:`!NamedTuple` class with 0 fields, use
``class NT(NamedTuple): pass`` or ``NT = NamedTuple("NT", [])``.

* :class:`typing.TypedDict`: When using the functional syntax to create a
:class:`!TypedDict` class, failing to pass a value to the *fields* parameter (``TD =
TypedDict("TD")``) is deprecated. Passing ``None`` to the *fields* parameter
(``TD = TypedDict("TD", None)``) is also deprecated. Both will be disallowed
in Python 3.15. To create a :class:`!TypedDict` class with 0 fields, use ``class
TD(TypedDict): pass`` or ``TD = TypedDict("TD", {})``.

* :mod:`wave`: Deprecate the ``getmark()``, ``setmark()`` and ``getmarkers()``
methods of the :class:`wave.Wave_read` and :class:`wave.Wave_write` classes.
They will be removed in Python 3.15.
(Contributed by Victor Stinner in :gh:`105096`.)

* :func:`~threading.RLock` will take no arguments in Python 3.15.
Passing any arguments has been deprecated since Python 3.14,
as the Python version does not permit any arguments,
but the C version allows any number of positional or keyword arguments,
ignoring every argument.

* :mod:`typing`:

* The undocumented keyword argument syntax for creating
:class:`~typing.NamedTuple` classes
(e.g. ``Point = NamedTuple("Point", x=int, y=int)``)
has been deprecated since Python 3.13.
Use the class-based syntax or the functional syntax instead.

* The :func:`typing.no_type_check_decorator` decorator function
has been deprecated since Python 3.13.
After eight years in the :mod:`typing` module,
it has yet to be supported by any major type checker.

* :mod:`wave`:

* The :meth:`~wave.Wave_read.getmark`, :meth:`!setmark`,
and :meth:`~wave.Wave_read.getmarkers` methods of
the :class:`~wave.Wave_read` and :class:`~wave.Wave_write` classes
have been deprecated since Python 3.13.
42 changes: 33 additions & 9 deletions Doc/deprecations/pending-removal-in-3.16.rst
Original file line number Diff line number Diff line change
@@ -1,18 +1,42 @@
Pending Removal in Python 3.16
------------------------------

* :mod:`builtins`:

* Bitwise inversion on boolean types, ``~True`` or ``~False``
has been deprecated since Python 3.12,
as it produces surprising and unintuitive results (``-2`` and ``-1``).
Use ``not x`` instead for the logical negation of a Boolean.
In the rare case that you need the bitwise inversion of
the underlying integer, convert to ``int`` explicitly (``~int(x)``).

* :mod:`array`:
:class:`array.array` ``'u'`` type (:c:type:`wchar_t`):
use the ``'w'`` type instead (``Py_UCS4``).

* :mod:`builtins`:
``~bool``, bitwise inversion on bool.
* The ``'u'`` format code (:c:type:`wchar_t`)
has been deprecated in documentation since Python 3.3
and at runtime since Python 3.13.
Use the ``'w'`` format code (:c:type:`Py_UCS4`)
for Unicode characters instead.

* :mod:`shutil`:

* The :class:`!ExecError` exception
has been deprecated since Python 3.14.
It has not been used by any function in :mod:`!shutil` since Python 3.4,
and is now an alias of :exc:`RuntimeError`.

* :mod:`symtable`:
Deprecate :meth:`symtable.Class.get_methods` due to the lack of interest.
(Contributed by Bénédikt Tran in :gh:`119698`.)

* :mod:`shutil`: Deprecate :class:`!shutil.ExecError`, which hasn't
been raised by any :mod:`!shutil` function since Python 3.4. It's
now an alias for :exc:`RuntimeError`.
* The :meth:`Class.get_methods <symtable.Class.get_methods>` method
has been deprecated since Python 3.14.

* :mod:`sys`:

* The :func:`~sys._enablelegacywindowsfsencoding` function
has been deprecated since Python 3.13.
Use the :envvar:`PYTHONLEGACYWINDOWSFSENCODING` environment variable instead.

* :mod:`tarfile`:

* The undocumented and unused :attr:`!TarFile.tarfile` attribute
has been deprecated since Python 3.13.
Loading
Loading