socketmodule.c: use atomics to access defaulttimeout
in free-threaded build
#116616
Closed
Labels
extension-modules
C modules in the Modules dir
topic-free-threading
type-feature
A feature request or enhancement
Feature or enhancement
The
defaulttimeout
insocketmodule.c
is shared, mutable state:cpython/Modules/socketmodule.c
Line 551 in 9f983e0
In the free-threaded build, we should use relaxed atomic operations to access
defaulttimeout
to avoid data races. This probably requires adding wrappers for 64-bit relaxed atomic load and stores to https://github.com/python/cpython/blob/main/Include/internal/pycore_pyatomic_ft_wrappers.h. Note that_PyTime_t
is a typedef forint64_t
.For context, here is a similar change from
nogil-3.12
, but note thatdefaulttimeout
is now part of the module state:Linked PRs
The text was updated successfully, but these errors were encountered: