@@ -391,52 +391,57 @@ detected by checking its tag for a ``-32`` suffix. All releases of Python
391
391
since 3.5 have included this in their 32-bit builds.
392
392
393
393
394
+ .. _whatsnew311-other-lang-changes :
395
+
394
396
Other Language Changes
395
397
======================
396
398
397
- * Starred expressions can be used in :ref: `for statements<for> `. (See
398
- :issue: `46725 ` for more details.)
399
-
400
- * Asynchronous comprehensions are now allowed inside comprehensions in
401
- asynchronous functions. Outer comprehensions implicitly become
402
- asynchronous. (Contributed by Serhiy Storchaka in :issue: `33346 `.)
399
+ * Starred unpacking expressions can now be used in :keyword: `for ` statements.
400
+ (See :issue: `46725 ` for more details.)
403
401
404
- * A :exc: `TypeError ` is now raised instead of an :exc: `AttributeError ` in
405
- :meth: `contextlib.ExitStack.enter_context ` and
406
- :meth: `contextlib.AsyncExitStack.enter_async_context ` for objects which do not
407
- support the :term: `context manager ` or :term: `asynchronous context manager `
408
- protocols correspondingly.
409
- (Contributed by Serhiy Storchaka in :issue: `44471 `.)
402
+ * Asynchronous :ref: `comprehensions <comprehensions >` are now allowed
403
+ inside comprehensions in :ref: `asynchronous functions <async def >`.
404
+ Outer comprehensions implicitly become asynchronous in this case.
405
+ (Contributed by Serhiy Storchaka in :issue: `33346 `.)
410
406
411
407
* A :exc: `TypeError ` is now raised instead of an :exc: `AttributeError ` in
412
- :keyword: `with ` and :keyword: `async with ` statements for objects which do not
413
- support the :term: `context manager ` or :term: `asynchronous context manager `
414
- protocols correspondingly.
415
- (Contributed by Serhiy Storchaka in :issue: `12022 `.)
416
-
417
- * Added :meth: `object.__getstate__ ` which provides the default
418
- implementation of the ``__getstate__() `` method. :mod: `Copying <copy> `
419
- and :mod: `pickling <pickle> ` instances of subclasses of builtin types
408
+ :keyword: `with ` statements and :meth: `contextlib.ExitStack.enter_context `
409
+ for objects that do not support the :term: `context manager ` protocol,
410
+ and in :keyword: `async with ` statements and
411
+ :meth: `contextlib.AsyncExitStack.enter_async_context `
412
+ for objects not supporting the :term: `asynchronous context manager ` protocol.
413
+ (Contributed by Serhiy Storchaka in :issue: `12022 ` and :issue: `44471 `.)
414
+
415
+ * Added :meth: `object.__getstate__ `, which provides the default
416
+ implementation of the :meth: `!__getstate__ ` method. :mod: `copy `\i ng
417
+ and :mod: `pickle `\i ng instances of subclasses of builtin types
420
418
:class: `bytearray `, :class: `set `, :class: `frozenset `,
421
419
:class: `collections.OrderedDict `, :class: `collections.deque `,
422
420
:class: `weakref.WeakSet `, and :class: `datetime.tzinfo ` now copies and
423
421
pickles instance attributes implemented as :term: `slots <__slots__> `.
424
422
(Contributed by Serhiy Storchaka in :issue: `26579 `.)
425
423
426
- * Add :option: `-P ` command line option and :envvar: `PYTHONSAFEPATH ` environment
427
- variable to not prepend a potentially unsafe path to :data: `sys.path ` such as
428
- the current directory, the script's directory or an empty string.
424
+ * Added a :option: `-P ` command line option
425
+ and a :envvar: `PYTHONSAFEPATH ` environment variable,
426
+ which disable the automatic prepending to :data: `sys.path `
427
+ of the script's directory when running a script,
428
+ or the current directory when using :option: `-c ` and :option: `-m `.
429
+ This ensures only stdlib and installed modules
430
+ are picked up by :keyword: `import `,
431
+ and avoids unintentionally or maliciously shadowing modules
432
+ with those in a local (and typically user-writable) directory.
429
433
(Contributed by Victor Stinner in :gh: `57684 `.)
430
434
431
- * A ``"z" `` option was added to the format specification mini-language that
432
- coerces negative zero to zero after rounding to the format precision. See
433
- :pep: `682 ` for more details. (Contributed by John Belmonte in :gh: `90153 `.)
435
+ * A ``"z" `` option was added to the :ref: `formatspec ` that
436
+ coerces negative to positive zero after rounding to the format precision.
437
+ See :pep: `682 ` for more details.
438
+ (Contributed by John Belmonte in :gh: `90153 `.)
434
439
435
- * Bytes are no longer accepted on :attr : `sys.path `. Support broke sometime
436
- between Python 3.2 and 3.6 with no one noticing until after Python 3.10.0
437
- was released. Bringing back support would also be problematic due to
438
- interactions between :option: `-b ` and :attr : `sys.path_importer_cache ` when
439
- there is a mixture of strings and bytes keys.
440
+ * Bytes are no longer accepted on :data : `sys.path `. Support broke sometime
441
+ between Python 3.2 and 3.6, with no one noticing until after Python 3.10.0
442
+ was released. In addition, bringing back support would be problematic due to
443
+ interactions between :option: `-b ` and :data : `sys.path_importer_cache ` when
444
+ there is a mixture of :class: ` str ` and :class: ` bytes ` keys.
440
445
(Contributed by Thomas Grainger in :gh: `91181 `.)
441
446
442
447
0 commit comments