@@ -122,18 +122,6 @@ it's safe to do so. This can lead to different values returned from
122122:func: `sys.getrefcount ` and :c:func: `Py_REFCNT ` compared to previous versions
123123of Python. See :ref: `below <whatsnew314-refcount >` for details.
124124
125- A new flag has been added, :data: `~sys.flags.context_aware_warnings `. This
126- flag defaults to true for the free-threaded build and false for the GIL-enabled
127- build. If the flag is true then the :class: `warnings.catch_warnings ` context
128- manager uses a context variable for warning filters.
129-
130- A new flag has been added, :data: `~sys.flags.thread_inherit_context `. This
131- flag defaults to true for the free-threaded build and false for the GIL-enabled
132- build. If the flag is true then threads created with :class: `threading.Thread `
133- start with a copy of the :class: `~contextvars.Context() ` of the caller of
134- :meth: `~threading.Thread.start `.
135-
136-
137125New features
138126============
139127
@@ -990,6 +978,23 @@ be specified by the build backend, as it will no longer be determined
990978automatically by the C compiler. For a running interpreter, the setting that
991979was used at compile time can be found using :func: `sysconfig.get_config_var `.
992980
981+ A new flag has been added, :data: `~sys.flags.context_aware_warnings `. This
982+ flag defaults to true for the free-threaded build and false for the GIL-enabled
983+ build. If the flag is true then the :class: `warnings.catch_warnings ` context
984+ manager uses a context variable for warning filters. This makes the context
985+ manager behave predicably when used with multiple threads or asynchronous
986+ tasks.
987+
988+ A new flag has been added, :data: `~sys.flags.thread_inherit_context `. This flag
989+ defaults to true for the free-threaded build and false for the GIL-enabled
990+ build. If the flag is true then threads created with :class: `threading.Thread `
991+ start with a copy of the :class: `~contextvars.Context() ` of the caller of
992+ :meth: `~threading.Thread.start `. Most significantly, this makes the warning
993+ filtering context established by :class: `~warnings.catch_warnings ` be
994+ "inherited" by threads (or asyncio tasks) started within that context. It also
995+ affects other modules that use context variables, such as the :mod: `decimal `
996+ context manager.
997+
993998
994999.. _whatsnew314-pyrepl-highlighting :
9951000
0 commit comments