Skip to content
Merged
Changes from 1 commit
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
24 changes: 24 additions & 0 deletions Doc/whatsnew/3.14.rst
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,18 @@ it's safe to do so. This can lead to different values returned from
:func:`sys.getrefcount` and :c:func:`Py_REFCNT` compared to previous versions
of Python. See :ref:`below <whatsnew314-refcount>` for details.

A new flag has been added, :data:`~sys.flags.context_aware_warnings`. This
Comment thread
nascheme marked this conversation as resolved.
Outdated
flag defaults to true for the free-threaded build and false for the GIL-enabled
build. If the flag is true then the :class:`warnings.catch_warnings` context
manager uses a context variable for warning filters.

A new flag has been added, :data:`~sys.flags.thread_inherit_context`. This
flag defaults to true for the free-threaded build and false for the GIL-enabled
build. If the flag is true then threads created with :class:`threading.Thread`
start with a copy of the :class:`~contextvars.Context()` of the caller of
:meth:`~threading.Thread.start`.


New features
============

Expand Down Expand Up @@ -1028,6 +1040,18 @@ Please report any bugs or major performance regressions that you encounter!

.. seealso:: :pep:`744`

Concurrent safe warnings control
--------------------------------

The :class:`warnings.catch_warnings` context manager will now optionally
use a context variable for warning filters. This is enabled by setting
the :data:`~sys.flags.context_aware_warnings` flag, either with the ``-X``
command-line option or an environment variable. This gives predicable
warnings control when using :class:`~warnings.catch_warnings` combined with
multiple threads or asynchronous tasks. The flag defaults to true for the
free-threaded build and false for the GIL-enabled build.

(Contributed by Neil Schemenauer and Kumar Aditya in :gh:`130010`.)

Other language changes
======================
Expand Down
Loading