]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
[3.14] gh-151218: Replace sys.flags in PyConfig_Set() (#151402) (#151553)
authorVictor Stinner <vstinner@python.org>
Tue, 16 Jun 2026 16:55:35 +0000 (18:55 +0200)
committerGitHub <noreply@github.com>
Tue, 16 Jun 2026 16:55:35 +0000 (18:55 +0200)
commit60132db980d847d39a2ff80e21bcb3c3d3404449
treec8162facf8517a757257c5c6777b5459c8f64726
parentaf459e5e3206bf1469b6940e058e7d4bd44c5af8
[3.14] gh-151218: Replace sys.flags in PyConfig_Set() (#151402) (#151553)

gh-151218: Replace sys.flags in PyConfig_Set() (#151402)

PyConfig_Set() and sys.set_int_max_str_digits() now replace
sys.flags (create a new object), instead of modifying sys.flags in-place.

Modifying sys.flags in-place can lead to data races when multiple
threads are reading or writing sys.flags in parallel.

Use _Py_atomic functions to get and set max_str_digits members.

(cherry picked from commit b16d23fc9fe9cb72fa15c8a3036753e5437b5b8c)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Doc/c-api/init_config.rst
Lib/test/test_capi/test_config.py
Lib/test/test_free_threading/test_sys.py [new file with mode: 0644]
Lib/test/test_sys.py
Misc/NEWS.d/next/Core_and_Builtins/2026-06-12-15-30-25.gh-issue-151218.5M_nv8.rst [new file with mode: 0644]
Objects/longobject.c
Python/initconfig.c
Python/pylifecycle.c
Python/sysmodule.c