From 8ade7e3ccf4bc222f63550854f5809fd2d3fddbd Mon Sep 17 00:00:00 2001 From: Jukka Lehtosalo Date: Thu, 30 Apr 2026 16:12:54 +0100 Subject: [PATCH] [mypyc] Add note about librt.strings thread safety --- mypyc/doc/librt_strings.rst | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/mypyc/doc/librt_strings.rst b/mypyc/doc/librt_strings.rst index 1213f39623d61..aece015f4f752 100644 --- a/mypyc/doc/librt_strings.rst +++ b/mypyc/doc/librt_strings.rst @@ -9,6 +9,14 @@ low-level string and bytes utilities. Classes ------- +Thread safety +^^^^^^^^^^^^^ + +``BytesWriter`` and ``StringWriter`` objects are unsafe to access from another +thread if they are concurrently modified (on free-threaded Python builds). They are optimized +for maximal performance, and they aren't fully synchronized. Read-only access from multiple +threads is safe. + BytesWriter ^^^^^^^^^^^