Skip to content

Commit f54e5c6

Browse files
committed
minor textual edits
1 parent 7fb6fc1 commit f54e5c6

File tree

1 file changed

+19
-15
lines changed

1 file changed

+19
-15
lines changed

docs/debugging.md

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -271,22 +271,26 @@ slower than a compiled version, so you should default to installing the wheel in
271271
CI instead of compiling Cython, which can take up to a few minutes on some CI
272272
runners.
273273

274-
### Compiling CPython and foundational packages with thread sanitizer (TSAN)
274+
## Compiling CPython and foundational packages with thread sanitizer (TSAN)
275275

276276
[Thread sanitizer](https://github.com/google/sanitizers/wiki/ThreadSanitizerCppManual) (or TSAN) helps
277277
to detect C/C++ data races in concurrent systems. This tool can help to reveal free-threading
278278
related bugs in CPython and foundational packages (e.g. `numpy`).
279-
In this section we provide the commands to build free-threading compatible CPython and packages with TSAN and other hints to discover potential data races.
279+
In this section we provide the commands to build a free-threading compatible
280+
CPython interpreter and packages with TSAN and other hints to discover
281+
potential data races.
280282

281-
#### Compile free-threading CPython with TSAN
283+
### Compile free-threaded CPython with TSAN
282284

283-
- Clone free-threading stable branch, e.g. 3.13
285+
- Clone the latest stable branch (`3.13`):
284286

285287
```bash
286288
git clone https://github.com/python/cpython.git -b 3.13
287289
```
288290

289-
- Configure and build the interpreter. Below instructions are for Linux (Windows and macOS may require some changes). We skip the instructions on how to install Clang compiler.
291+
- Configure and build the interpreter. Below instructions are for Linux
292+
(Windows and macOS may require some changes). We skip the instructions on how
293+
to install the Clang compiler.
290294

291295
```bash
292296
cd cpython
@@ -295,37 +299,37 @@ make -j 8
295299
make install
296300
```
297301

298-
- Use built Python interpreter:
302+
- To use the built Python interpreter:
299303

300304
```bash
301-
# Create virtual environment:
305+
# Create a virtual environment:
302306
$PWD/cpython-tsan/bin/python3.13t -m venv ~/tsanvenv
303-
# Activate it:
307+
# Then activate it:
304308
source ~/tsanvenv/bin/activate
305309

306310
python -VV
307311
# Python 3.13.1 experimental free-threading build (tags/v3.13.1:06714517797, Dec 19 2024, 10:06:54) [Clang 18.1.3 (1ubuntu1)]
308312
PYTHON_GIL=0 python -c "import sys; print(sys._is_gil_enabled())"
309313
# False
310314

311-
# Optionally, exit cpython folder
315+
# Exit the `cpython` folder (preparation for the next step below)
312316
cd ..
313317
```
314318

315-
#### Compile NumPy with TSAN
319+
### Compile NumPy with TSAN
316320

317-
- Get the source code (for example, `main` branch)
321+
- Get the source code (for example, the `main` branch)
318322

319323
```bash
320324
git clone --recursive https://github.com/numpy/numpy.git
321325
```
322326

323-
- Install build requirements:
327+
- Install the build requirements:
324328

325329
```bash
326330
cd numpy
327331
python -m pip install -r requirements/build_requirements.txt
328-
# Make sure to install compatible Cython version
332+
# Make sure to install a compatible Cython version (master branch is best for now)
329333
python -m pip install -U git+https://github.com/cython/cython
330334
```
331335

@@ -343,13 +347,13 @@ python -m pip install -v . --no-build-isolation
343347

344348
### Useful TSAN options
345349

346-
- By default TSAN reports warnings. How to stop execution on TSAN error:
350+
- By default TSAN reports warnings. To stop execution on TSAN errors, use:
347351

348352
```bash
349353
TSAN_OPTIONS=halt_on_error=1 python -m pytest test.py
350354
```
351355

352-
- How to add TSAN suppressions (written in a file: `tsan-suppressions`):
356+
- To add TSAN suppressions (written in a file: `tsan-suppressions`):
353357

354358
```bash
355359
# Let's show an example content of suppressions,

0 commit comments

Comments
 (0)