Skip to content

Commit

Permalink
Link to cpython_sanity repo for TSAN debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
ngoldbaum committed Feb 24, 2025
1 parent eb1775f commit 6ebdc64
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions docs/debugging.md
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,16 @@ In this section we provide the commands to build a free-threading compatible
CPython interpreter and packages with TSAN and other hints to discover
potential data races.

### `cpython_sanity` docker images

To ease working with thread sanitizer in projects that use Python, Numpy, and
Scipy, we have create a set of docker images that contain a pre-built Python
interpreter and common dependencies that can be tricky to build.

See [the `cpython_sanity`
repository](https://github.com/nascheme/cpython_sanity) for more information
about how to use the docker images.

### Compile free-threaded CPython with TSAN

- Clone the latest stable branch (`3.13`):
Expand Down Expand Up @@ -316,6 +326,14 @@ PYTHON_GIL=0 python -c "import sys; print(sys._is_gil_enabled())"
cd ..
```

If you use pyenv, you can also enable a thread sanitizer build with `pyenv install` like so:

```bash
CC=/path/to/clang CXX=/path/to/clang++ CONFIGURE_OPTS="--with-thread-sanitizer" pyenv install 3.14t-dev
```

And then activate the build with e.g. `pyenv local 3.14t-dev`.

!!! note

On MacOS, you may see messages like this when you start Python:
Expand Down

0 comments on commit 6ebdc64

Please sign in to comment.