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-109190: Copyedit 3.12 What's New: Deprecations #109766

Merged
merged 4 commits into from
Sep 26, 2023

Conversation

AA-Turner
Copy link
Member

@AA-Turner AA-Turner commented Sep 22, 2023

Sorry in advance for the large PR.

The main change here is ensuring that every deprecated API is listed under the "Deprecated" section. Previously, some deprecations were only listed under "Deprecated", some were listed under the "Pending Removal in Python 3.14" subheading, and some were listed under both. This was a confusing state of affairs, and unhelpful to readers. From this PR, the "Pending Removal in Python 3.14" section becomes a short list of APIs pending removal, reflecting the layout of the similar "3.13" and "Future Versions" sections.

A


📚 Documentation preview 📚: https://cpython-previews--109766.org.readthedocs.build/en/109766/whatsnew/3.12.html#deprecated

@AA-Turner AA-Turner added the needs backport to 3.12 bug and security fixes label Sep 22, 2023
@bedevere-app bedevere-app bot added awaiting review docs Documentation in the Doc dir skip news labels Sep 22, 2023
Comment on lines -579 to -595
* The child watcher classes :class:`asyncio.MultiLoopChildWatcher`,
:class:`asyncio.FastChildWatcher`, :class:`asyncio.AbstractChildWatcher`
and :class:`asyncio.SafeChildWatcher` are deprecated and
will be removed in Python 3.14. It is recommended to not manually
configure a child watcher as the event loop now uses the best available
child watcher for each platform (:class:`asyncio.PidfdChildWatcher`
if supported and :class:`asyncio.ThreadedChildWatcher` otherwise).
(Contributed by Kumar Aditya in :gh:`94597`.)

* :func:`asyncio.set_child_watcher`, :func:`asyncio.get_child_watcher`,
:meth:`asyncio.AbstractEventLoopPolicy.set_child_watcher` and
:meth:`asyncio.AbstractEventLoopPolicy.get_child_watcher` are deprecated
and will be removed in Python 3.14.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

asyncio had two deprecations noted in "Improved Modules", these have been moved

Comment on lines +1036 to +1039
* :mod:`argparse`: The *type*, *choices*, and *metavar* parameters
of :class:`!argparse.BooleanOptionalAction` are deprecated
and will be removed in 3.14.
(Contributed by Nikita Sobolev in :gh:`92248`.)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copied from Pending Removal

Comment on lines +1041 to +1052
* :mod:`ast`: The following :mod:`ast` features have been deprecated in documentation since
Python 3.8, now cause a :exc:`DeprecationWarning` to be emitted at runtime
when they are accessed or used, and will be removed in Python 3.14:

* :class:`!ast.Num`
* :class:`!ast.Str`
* :class:`!ast.Bytes`
* :class:`!ast.NameConstant`
* :class:`!ast.Ellipsis`

Use :class:`ast.Constant` instead.
(Contributed by Serhiy Storchaka in :gh:`90953`.)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copied from Pending Removal

Comment on lines +1054 to +1071
* :mod:`asyncio`:

* The child watcher classes :class:`asyncio.MultiLoopChildWatcher`,
:class:`asyncio.FastChildWatcher`, :class:`asyncio.AbstractChildWatcher`
and :class:`asyncio.SafeChildWatcher` are deprecated and
will be removed in Python 3.14.
(Contributed by Kumar Aditya in :gh:`94597`.)

* :func:`asyncio.set_child_watcher`, :func:`asyncio.get_child_watcher`,
:meth:`asyncio.AbstractEventLoopPolicy.set_child_watcher` and
:meth:`asyncio.AbstractEventLoopPolicy.get_child_watcher` are deprecated
and will be removed in Python 3.14.
(Contributed by Kumar Aditya in :gh:`94597`.)

* The :meth:`~asyncio.get_event_loop` method of the
default event loop policy now emits a :exc:`DeprecationWarning` if there
is no current event loop set and it decides to create one.
(Contributed by Serhiy Storchaka and Guido van Rossum in :gh:`100160`.)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(1) and (2) copied from Improved Modules, (3) copied from Pending Removal. Note that I've deleted the entry for asyncio.Future.cancel & asyncio.Task.cancel as it was reverted in #97999

Comment on lines +1077 to +1081
* :mod:`collections.abc`: Deprecated :class:`collections.abc.ByteString`.
Prefer :class:`Sequence` or :class:`collections.abc.Buffer`.
For use in typing, prefer a union, like ``bytes | bytearray``, or :class:`collections.abc.Buffer`.
(Contributed by Shantanu Jain in :gh:`91896`.)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copied from Pending Removal

Comment on lines +1180 to +1182
* The 3-arg signatures (type, value, traceback) of :meth:`coroutine throw()
<coroutine.throw>`, :meth:`generator throw() <generator.throw>` and
:meth:`async generator throw() <agen.athrow>` are deprecated and
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added explicit titles to avoid the text saying throw(), throw(), and athrow()

Comment on lines +1191 to +1193
* Setting ``__package__`` or ``__cached__`` on a module is deprecated,
and will cease to be set or taken into consideration by the import system in Python 3.14.
(Contributed by Brett Cannon in :gh:`65961`.)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rephrased from Pending Removal

@@ -1116,9 +1200,14 @@ Deprecated
* The bitwise inversion operator (``~``) on bool is deprecated. It will throw an
error in Python 3.14. Use ``not`` for logical negation of bools instead.
In the rare case that you really need the bitwise inversion of the underlying
``int``, convert to int explicitly with ``~int(x)``. (Contributed by Tim Hoffmann
``int``, convert to int explicitly: ``~int(x)``. (Contributed by Tim Hoffmann
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style -- this is both the conversion and inversion, so don't say "with"

Comment on lines +1206 to +1209
* Accessing ``co_lnotab`` on code objects was deprecated in Python 3.10 via :pep:`626`,
but it only got a proper :exc:`DeprecationWarning` in 3.12,
therefore it will be removed in 3.14.
(Contributed by Nikita Sobolev in :gh:`101866`.)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rephrased from Pending Removal

Comment on lines +1259 to +1260
The following APIs have been deprecated
and will be removed in Python 3.14.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adapted from the Pending Removal in Python 3.13 summary

Copy link
Member

@hugovk hugovk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, looks good.

It wasn't modified in this PR, but the sqlite3 bullets are overindented (compare typing), shall we fix them here too?

image

@AA-Turner
Copy link
Member Author

shall we fix them here too?

Might as well; pushed a commit.

A

@hugovk hugovk merged commit 87ddfa7 into python:main Sep 26, 2023
16 checks passed
@miss-islington
Copy link
Contributor

Thanks @AA-Turner for the PR, and @hugovk for merging it 🌮🎉.. I'm working now to backport this PR to: 3.12.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Sep 26, 2023
)

(cherry picked from commit 87ddfa7)

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
@bedevere-app
Copy link

bedevere-app bot commented Sep 26, 2023

GH-109925 is a backport of this pull request to the 3.12 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.12 bug and security fixes label Sep 26, 2023
Yhg1s pushed a commit that referenced this pull request Sep 27, 2023
…109925)

* GH-109190: Copyedit 3.12 What's New: Deprecations (GH-109766)
(cherry picked from commit 87ddfa7)

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>

* GH-109190: Copyedit 3.12 What's New: Deprecations (``os`` fix)  (#109927)

Merge the two ``os`` entries

(cherry picked from commit 0e28d0f)

---------

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
csm10495 pushed a commit to csm10495/cpython that referenced this pull request Sep 28, 2023
@AA-Turner AA-Turner deleted the docs/whatsnew/deprecations branch September 29, 2023 08:16
Glyphack pushed a commit to Glyphack/cpython that referenced this pull request Sep 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation in the Doc dir skip news
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants