[Minor Feature] Free-threaded CPython + TSan Makefile targets #281

Closed
opened 2026-03-08 03:19:42 +00:00 by john · 0 comments
Owner

Context

tools/build_debug_python.sh already supports --free-threaded and --tsan flags producing libpython3.14t.so. However, no Makefile targets exist to build McRogueFace against free-threaded Python, and the CMake has no support for linking python3.14t instead of python3.14.

Proposal

  1. Add CMake option MCRF_FREE_THREADED_PYTHON that links against python3.14t (or python3.14td for debug)
  2. Add Makefile targets:
    • make tsan — build with TSan + free-threaded debug Python
    • make tsan-test — run test suite under TSan
  3. TSan would detect #269 (PythonObjectCache mutex-less hash map reads) and any future threading bugs

Prerequisites

  • Modern Clang (18+) recommended for TSan — GCC 12's TSan has higher false-positive rates with atomics (see #281)
  • Free-threaded CPython build via tools/build_debug_python.sh --tsan
  • #269 (PythonObjectCache race condition)
  • #279 (memory safety audit meta-issue)
## Context `tools/build_debug_python.sh` already supports `--free-threaded` and `--tsan` flags producing `libpython3.14t.so`. However, no Makefile targets exist to build McRogueFace against free-threaded Python, and the CMake has no support for linking `python3.14t` instead of `python3.14`. ## Proposal 1. Add CMake option `MCRF_FREE_THREADED_PYTHON` that links against `python3.14t` (or `python3.14td` for debug) 2. Add Makefile targets: - `make tsan` — build with TSan + free-threaded debug Python - `make tsan-test` — run test suite under TSan 3. TSan would detect #269 (PythonObjectCache mutex-less hash map reads) and any future threading bugs ## Prerequisites - Modern Clang (18+) recommended for TSan — GCC 12's TSan has higher false-positive rates with atomics (see #281) - Free-threaded CPython build via `tools/build_debug_python.sh --tsan` ## Related - #269 (PythonObjectCache race condition) - #279 (memory safety audit meta-issue)
john closed this issue 2026-04-10 08:08:46 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
john/McRogueFace#281
No description provided.