Repository navigation
Commit d43adfe
authored
Drop -I from the ASan test command so PYTHONMALLOC takes effect (#1499)
<!-- Thank you for your contribution! -->
## What do these changes do?
The ASan test command in `AGENTS.md` and in the CI `asan` job ran
`python -Im pytest` with `PYTHONMALLOC=malloc`. `-I` implies `-E`, so
Python ignored `PYTHONMALLOC` and kept serving small allocations from
pymalloc arenas. Most `htkeys_t` tables are 512 bytes or less, so ASan
could not detect use-after-free on them. This drops `-I` in both places
and adds a short note explaining why it must stay out. The TSan command
and job, and the `Makefile`, do not combine `-I`/`-E` with
`PYTHONMALLOC` and are unchanged.
## Are there changes in behavior for the user?
No. Contributor-facing only.
## Is it a substantial burden for the maintainers to support this?
No.
## Related issue number
N/A
## Checklist
- [x] I think the code is well written
- [ ] Unit tests for the changes exist: N/A, docs and CI invocation only
- [x] Documentation reflects the changes
- [ ] If you provide code modification, please add yourself to
`CONTRIBUTORS.txt`: N/A
- [x] Add a new news fragment into the `CHANGES/` folder
- [x] `make doc-spelling` passes and any new technical words are added
to `docs/spelling_wordlist.txt`
Drafted with Claude Opus 5 (Claude Code); reviewed by @asvetlov.
<details>
<summary>Agent run details (optional, for reviewers)</summary>
Allocator check on CPython 3.13.2: `PYTHONMALLOC=malloc python -c
...pymem_getallocatorsname()` reports `malloc`; with `-I` it reports
`pymalloc`.
Earlier manual check:
`tests/test_multidict.py::test_items_iter_key_str_reinits` (from #1496)
hits a heap-use-after-free on the pre-fix code under `python -m pytest`,
but passes under `python -Im pytest`.
Corrected command on current master, ASan+UBSan build, isolated 3.13.2
venv: `LD_PRELOAD=$ASAN_SO ASAN_OPTIONS=detect_leaks=0:halt_on_error=1
PYTHONMALLOC=malloc python -m pytest tests -q --no-cov -k "not
test_leak"` gave 2048 passed, 21 skipped, 11 deselected. So turning on
real malloc in CI does not make master fail.
`make doc-spelling`: passed. Pre-commit hooks: passed.
</details>1 parent 2a68472 commit d43adfe
3 files changed
Lines changed: 29 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
586 | 586 | | |
587 | 587 | | |
588 | 588 | | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
589 | 595 | | |
590 | 596 | | |
591 | 597 | | |
| |||
596 | 602 | | |
597 | 603 | | |
598 | 604 | | |
599 | | - | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
600 | 608 | | |
601 | 609 | | |
602 | 610 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
379 | 379 | | |
380 | 380 | | |
381 | 381 | | |
382 | | - | |
| 382 | + | |
383 | 383 | | |
384 | 384 | | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
385 | 399 | | |
386 | 400 | | |
387 | 401 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
0 commit comments