Repository navigation
Conversation
There was no documentation on using ThreadSanitizer with the free-threaded build beyond the configure option. Describe how to build, how extensions are instrumented, how to read a report, and how to run CPython's TSan tests, and note that TSan does not detect logic races in Python code.
johng
requested review from
AA-Turner,
corona10 and
erlend-aasland
as code owners
November 2, 2026 09:49
18 of 49 tasks
Contributor
Author
|
I can't say I'm an expert on using TSAN only using what has been required to find some FT bugs in the past (so maybe some better people to have raised/reviewed this), from what I can see this is correct and enough to get started though |
The HOWTO sets the default highlight language to C, so the TSan report was lexed as C and raised a highlighting warning. Mark it, and the shell commands, with explicit languages.
Documentation build overview
|
corona10
reviewed
Nov 2, 2026
| Enable ThreadSanitizer data race detector, ``tsan`` | ||
| (default is no). | ||
| (default is no). It is most useful together with :option:`--disable-gil`. | ||
| See :ref:`freethreading-tsan`. |
Member
There was a problem hiding this comment.
This sentence is acutally needed?
Contributor
Author
There was a problem hiding this comment.
I had made this in relation to FT but Doc/howto/free-threading-extensions.rst change should be enough of a reference?
| SUMMARY: ThreadSanitizer: data race racy.c:8 in bump | ||
| The TSan runtime can be configured with the ``TSAN_OPTIONS`` environment | ||
| variable, for example ``TSAN_OPTIONS="suppressions=path/to/suppressions.txt"`` |
Member
There was a problem hiding this comment.
This feels like it belongs in https://devguide.python.org/development-tools/sanitizers/ instead, but I'll leave the decision up to the free-threading experts.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of the free-threading docs tracking issue (gh-145912).
The only documentation of ThreadSanitizer was the one-line
--with-thread-sanitizerentry inusing/configure.rst. This adds a "Testing with ThreadSanitizer" section to the free-threading extensions HOWTO covering:--disable-gil --with-thread-sanitizer)TSAN_OPTIONS/ the suppressions file inTools/tsan/--tsan,--tsan-parallel)using/configure.rstnow links to it from--with-thread-sanitizer.