diff options
author | C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM> | 2022-10-04 23:16:37 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-04 23:16:37 (GMT) |
commit | a77d9dedcd0d52c2663e9de4417dec9d1c5199f4 (patch) | |
tree | b589553f22321e822c1f7d8465234877e546fdd5 /Doc | |
parent | 0bf6a617ed1832bc4803e532c8d6b3427cf48b13 (diff) | |
download | cpython-a77d9dedcd0d52c2663e9de4417dec9d1c5199f4.zip cpython-a77d9dedcd0d52c2663e9de4417dec9d1c5199f4.tar.gz cpython-a77d9dedcd0d52c2663e9de4417dec9d1c5199f4.tar.bz2 |
gh-95913: Copyedit/improve Other Language Changes What's New section (#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 <ezio.melotti@gmail.com>
Co-authored-by: Ezio Melotti <ezio.melotti@gmail.com>
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/whatsnew/3.11.rst | 67 |
1 files changed, 36 insertions, 31 deletions
diff --git a/Doc/whatsnew/3.11.rst b/Doc/whatsnew/3.11.rst index c7233aa..173580d 100644 --- a/Doc/whatsnew/3.11.rst +++ b/Doc/whatsnew/3.11.rst @@ -427,52 +427,57 @@ See `this message from the Steering Council <https://mail.python.org/archives/li for more information. +.. _whatsnew311-other-lang-changes: + Other Language Changes ====================== -* Starred expressions can be used in :ref:`for statements<for>`. (See - :issue:`46725` for more details.) - -* Asynchronous comprehensions are now allowed inside comprehensions in - asynchronous functions. Outer comprehensions implicitly become - asynchronous. (Contributed by Serhiy Storchaka in :issue:`33346`.) +* Starred unpacking expressions can now be used in :keyword:`for` statements. + (See :issue:`46725` for more details.) -* A :exc:`TypeError` is now raised instead of an :exc:`AttributeError` in - :meth:`contextlib.ExitStack.enter_context` and - :meth:`contextlib.AsyncExitStack.enter_async_context` for objects which do not - support the :term:`context manager` or :term:`asynchronous context manager` - protocols correspondingly. - (Contributed by Serhiy Storchaka in :issue:`44471`.) +* Asynchronous :ref:`comprehensions <comprehensions>` are now allowed + inside comprehensions in :ref:`asynchronous functions <async def>`. + Outer comprehensions implicitly become asynchronous in this case. + (Contributed by Serhiy Storchaka in :issue:`33346`.) * A :exc:`TypeError` is now raised instead of an :exc:`AttributeError` in - :keyword:`with` and :keyword:`async with` statements for objects which do not - support the :term:`context manager` or :term:`asynchronous context manager` - protocols correspondingly. - (Contributed by Serhiy Storchaka in :issue:`12022`.) - -* Added :meth:`object.__getstate__` which provides the default - implementation of the ``__getstate__()`` method. :mod:`Copying <copy>` - and :mod:`pickling <pickle>` instances of subclasses of builtin types + :keyword:`with` statements and :meth:`contextlib.ExitStack.enter_context` + for objects that do not support the :term:`context manager` protocol, + and in :keyword:`async with` statements and + :meth:`contextlib.AsyncExitStack.enter_async_context` + for objects not supporting the :term:`asynchronous context manager` protocol. + (Contributed by Serhiy Storchaka in :issue:`12022` and :issue:`44471`.) + +* Added :meth:`object.__getstate__`, which provides the default + implementation of the :meth:`!__getstate__` method. :mod:`copy`\ing + and :mod:`pickle`\ing instances of subclasses of builtin types :class:`bytearray`, :class:`set`, :class:`frozenset`, :class:`collections.OrderedDict`, :class:`collections.deque`, :class:`weakref.WeakSet`, and :class:`datetime.tzinfo` now copies and pickles instance attributes implemented as :term:`slots <__slots__>`. (Contributed by Serhiy Storchaka in :issue:`26579`.) -* Add :option:`-P` command line option and :envvar:`PYTHONSAFEPATH` environment - variable to not prepend a potentially unsafe path to :data:`sys.path` such as - the current directory, the script's directory or an empty string. +* Added a :option:`-P` command line option + and a :envvar:`PYTHONSAFEPATH` environment variable, + which disable the automatic prepending to :data:`sys.path` + of the script's directory when running a script, + or the current directory when using :option:`-c` and :option:`-m`. + This ensures only stdlib and installed modules + are picked up by :keyword:`import`, + and avoids unintentionally or maliciously shadowing modules + with those in a local (and typically user-writable) directory. (Contributed by Victor Stinner in :gh:`57684`.) -* A ``"z"`` option was added to the format specification mini-language that - coerces negative zero to zero after rounding to the format precision. See - :pep:`682` for more details. (Contributed by John Belmonte in :gh:`90153`.) +* A ``"z"`` option was added to the :ref:`formatspec` that + coerces negative to positive zero after rounding to the format precision. + See :pep:`682` for more details. + (Contributed by John Belmonte in :gh:`90153`.) -* Bytes are no longer accepted on :attr:`sys.path`. Support broke sometime - between Python 3.2 and 3.6 with no one noticing until after Python 3.10.0 - was released. Bringing back support would also be problematic due to - interactions between :option:`-b` and :attr:`sys.path_importer_cache` when - there is a mixture of strings and bytes keys. +* Bytes are no longer accepted on :data:`sys.path`. Support broke sometime + between Python 3.2 and 3.6, with no one noticing until after Python 3.10.0 + was released. In addition, bringing back support would be problematic due to + interactions between :option:`-b` and :data:`sys.path_importer_cache` when + there is a mixture of :class:`str` and :class:`bytes` keys. (Contributed by Thomas Grainger in :gh:`91181`.) Other CPython Implementation Changes |