Skip to content

Commit a13b4e8

Browse files
gh-95913: Copyedit/improve Other Language Changes What's New section (GH-97719)
* Add/refine cross references to items in other lang changes section * Unify context manager exception changes into single non-repetitive item * More clearly describe the intent and consequences of the -P option * Apply minor clarifications & copyedits to rest of section * Tweak the formatting of module references Co-authored-by: Ezio Melotti <[email protected]> Co-authored-by: Ezio Melotti <[email protected]> (cherry picked from commit a77d9de) Co-authored-by: C.A.M. Gerlach <[email protected]>
1 parent a685cc0 commit a13b4e8

File tree

1 file changed

+36
-31
lines changed

1 file changed

+36
-31
lines changed

Doc/whatsnew/3.11.rst

+36-31
Original file line numberDiff line numberDiff line change
@@ -427,52 +427,57 @@ See `this message from the Steering Council <https://mail.python.org/archives/li
427427
for more information.
428428

429429

430+
.. _whatsnew311-other-lang-changes:
431+
430432
Other Language Changes
431433
======================
432434

433-
* Starred expressions can be used in :ref:`for statements<for>`. (See
434-
:issue:`46725` for more details.)
435-
436-
* Asynchronous comprehensions are now allowed inside comprehensions in
437-
asynchronous functions. Outer comprehensions implicitly become
438-
asynchronous. (Contributed by Serhiy Storchaka in :issue:`33346`.)
435+
* Starred unpacking expressions can now be used in :keyword:`for` statements.
436+
(See :issue:`46725` for more details.)
439437

440-
* A :exc:`TypeError` is now raised instead of an :exc:`AttributeError` in
441-
:meth:`contextlib.ExitStack.enter_context` and
442-
:meth:`contextlib.AsyncExitStack.enter_async_context` for objects which do not
443-
support the :term:`context manager` or :term:`asynchronous context manager`
444-
protocols correspondingly.
445-
(Contributed by Serhiy Storchaka in :issue:`44471`.)
438+
* Asynchronous :ref:`comprehensions <comprehensions>` are now allowed
439+
inside comprehensions in :ref:`asynchronous functions <async def>`.
440+
Outer comprehensions implicitly become asynchronous in this case.
441+
(Contributed by Serhiy Storchaka in :issue:`33346`.)
446442

447443
* A :exc:`TypeError` is now raised instead of an :exc:`AttributeError` in
448-
:keyword:`with` and :keyword:`async with` statements for objects which do not
449-
support the :term:`context manager` or :term:`asynchronous context manager`
450-
protocols correspondingly.
451-
(Contributed by Serhiy Storchaka in :issue:`12022`.)
452-
453-
* Added :meth:`object.__getstate__` which provides the default
454-
implementation of the ``__getstate__()`` method. :mod:`Copying <copy>`
455-
and :mod:`pickling <pickle>` instances of subclasses of builtin types
444+
:keyword:`with` statements and :meth:`contextlib.ExitStack.enter_context`
445+
for objects that do not support the :term:`context manager` protocol,
446+
and in :keyword:`async with` statements and
447+
:meth:`contextlib.AsyncExitStack.enter_async_context`
448+
for objects not supporting the :term:`asynchronous context manager` protocol.
449+
(Contributed by Serhiy Storchaka in :issue:`12022` and :issue:`44471`.)
450+
451+
* Added :meth:`object.__getstate__`, which provides the default
452+
implementation of the :meth:`!__getstate__` method. :mod:`copy`\ing
453+
and :mod:`pickle`\ing instances of subclasses of builtin types
456454
:class:`bytearray`, :class:`set`, :class:`frozenset`,
457455
:class:`collections.OrderedDict`, :class:`collections.deque`,
458456
:class:`weakref.WeakSet`, and :class:`datetime.tzinfo` now copies and
459457
pickles instance attributes implemented as :term:`slots <__slots__>`.
460458
(Contributed by Serhiy Storchaka in :issue:`26579`.)
461459

462-
* Add :option:`-P` command line option and :envvar:`PYTHONSAFEPATH` environment
463-
variable to not prepend a potentially unsafe path to :data:`sys.path` such as
464-
the current directory, the script's directory or an empty string.
460+
* Added a :option:`-P` command line option
461+
and a :envvar:`PYTHONSAFEPATH` environment variable,
462+
which disable the automatic prepending to :data:`sys.path`
463+
of the script's directory when running a script,
464+
or the current directory when using :option:`-c` and :option:`-m`.
465+
This ensures only stdlib and installed modules
466+
are picked up by :keyword:`import`,
467+
and avoids unintentionally or maliciously shadowing modules
468+
with those in a local (and typically user-writable) directory.
465469
(Contributed by Victor Stinner in :gh:`57684`.)
466470

467-
* A ``"z"`` option was added to the format specification mini-language that
468-
coerces negative zero to zero after rounding to the format precision. See
469-
:pep:`682` for more details. (Contributed by John Belmonte in :gh:`90153`.)
471+
* A ``"z"`` option was added to the :ref:`formatspec` that
472+
coerces negative to positive zero after rounding to the format precision.
473+
See :pep:`682` for more details.
474+
(Contributed by John Belmonte in :gh:`90153`.)
470475

471-
* Bytes are no longer accepted on :attr:`sys.path`. Support broke sometime
472-
between Python 3.2 and 3.6 with no one noticing until after Python 3.10.0
473-
was released. Bringing back support would also be problematic due to
474-
interactions between :option:`-b` and :attr:`sys.path_importer_cache` when
475-
there is a mixture of strings and bytes keys.
476+
* Bytes are no longer accepted on :data:`sys.path`. Support broke sometime
477+
between Python 3.2 and 3.6, with no one noticing until after Python 3.10.0
478+
was released. In addition, bringing back support would be problematic due to
479+
interactions between :option:`-b` and :data:`sys.path_importer_cache` when
480+
there is a mixture of :class:`str` and :class:`bytes` keys.
476481
(Contributed by Thomas Grainger in :gh:`91181`.)
477482

478483
Other CPython Implementation Changes

0 commit comments

Comments
 (0)