From 96b37d18ccb9d2c5a55f75bb1e82ba49eaf5d072 Mon Sep 17 00:00:00 2001 From: Donghee Na Date: Wed, 2 Apr 2025 22:57:33 +0900 Subject: [PATCH 1/2] gh-131544: Update docs for PyType_AddWatcher --- Doc/c-api/type.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Doc/c-api/type.rst b/Doc/c-api/type.rst index 862f1e67b9ad2d..354c6daf73fbf7 100644 --- a/Doc/c-api/type.rst +++ b/Doc/c-api/type.rst @@ -82,6 +82,9 @@ Type Objects error (e.g. no more watcher IDs available), return ``-1`` and set an exception. + In free-threaded builds, :c:func:`PyType_AddWatcher` is not thread-safe, + so it must be called at start up. + .. versionadded:: 3.12 From 8f30b073eb44956837dd5e35b11270dd82d45cd1 Mon Sep 17 00:00:00 2001 From: Donghee Na Date: Wed, 2 Apr 2025 23:51:22 +0900 Subject: [PATCH 2/2] Address review --- Doc/c-api/type.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/c-api/type.rst b/Doc/c-api/type.rst index 354c6daf73fbf7..ec2867b0ce09ba 100644 --- a/Doc/c-api/type.rst +++ b/Doc/c-api/type.rst @@ -83,7 +83,7 @@ Type Objects exception. In free-threaded builds, :c:func:`PyType_AddWatcher` is not thread-safe, - so it must be called at start up. + so it must be called at start up (before spawning the first thread). .. versionadded:: 3.12