Skip to content

Commit 8871ee9

Browse files
committed
ci(tests): suppress CPython 3.12 interned-unicode leak (PyUnicode_New) in sanitizer runs
Under ASan/LSan with Python 3.12 on Ubuntu 22.04/24.04, the cleanup tests report direct leaks rooted in CPython’s unicode interning path (frames via PyUnicode_New) during module import in our embedded init. This is a known CPython issue (python/cpython#113190). Interned-unicode cleanup was re-enabled in 3.13 (python/cpython#113601) but not backported to 3.12. To keep CI signal meaningful while we still test against 3.12, enable a narrow LSan suppression for PyUnicode_New only, and only on 3.12. Notes: - detect_leaks=1 remains enabled; the suppression is limited to PyUnicode_New and won’t mask leaks in PythonQt. - Remove once CI moves off Python 3.12. Refs: python/cpython#113190, python/cpython#113601
1 parent f5391ab commit 8871ee9

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

.github/workflows/build.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,14 @@ jobs:
8585
8686
- name: Run cleanup tests with sanitizers
8787
run: |
88+
# CPython 3.12 only: suppress its known interned-unicode leak that
89+
# shows up as allocations via PyUnicode_New (python/cpython#113190).
90+
# Fixed in 3.13 (python/cpython#113601), so we scope this to 3.12.
91+
PYVER=$(python3 -c 'import sys; print(".".join(map(str, sys.version_info[:2])))')
92+
if [[ "$PYVER" == "3.12" ]]; then
93+
echo "leak:PyUnicode_New" >> $PWD/lsan.supp
94+
export LSAN_OPTIONS="suppressions=$PWD/lsan.supp"
95+
fi
8896
PYTHONDEVMODE=1 PYTHONASYNCIODEBUG=1 PYTHONWARNINGS=error PYTHONMALLOC=malloc_debug \
8997
UBSAN_OPTIONS="halt_on_error=1" ASAN_OPTIONS="detect_leaks=1:detect_stack_use_after_return=1:fast_unwind_on_malloc=0" \
9098
PYTHONQT_RUN_ONLY_CLEANUP_TESTS=1 \

0 commit comments

Comments
 (0)