]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
[3.15] gh-151218: Replace sys.flags in PyConfig_Set() (GH-151402) (#151552) 3.15
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Tue, 16 Jun 2026 16:48:56 +0000 (18:48 +0200)
committerGitHub <noreply@github.com>
Tue, 16 Jun 2026 16:48:56 +0000 (16:48 +0000)
commitff6e973c3bbe419ff8aef16b05a1c77749c073c2
tree3638883eb5e8fc6efbbb2a96cc4bd9d8a9eb8e52
parent19bf6a3fa1d1497f8b73f971df07109f2da000ca
[3.15] gh-151218: Replace sys.flags in PyConfig_Set() (GH-151402) (#151552)

gh-151218: Replace sys.flags in PyConfig_Set() (GH-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: Victor Stinner <vstinner@python.org>
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