Skip to content

gh-136872: Let --with-pymalloc override the sanitizer default - #157934

Open
vasiliyk wants to merge 5 commits into
python:mainfrom
vasiliyk:136872-pymalloc
Open

vasiliyk wants to merge 5 commits into
python:mainfrom
vasiliyk:136872-pymalloc

Conversation

@vasiliyk

@vasiliyk vasiliyk commented Sep 21, 2026

Copy link
Copy Markdown
Contributor

The --with-address-sanitizer and --with-memory-sanitizer configure options unconditionally set with_pymalloc=no, so an explicit --with-pymalloc was silently ignored.

Only apply that default when --with-pymalloc or --without-pymalloc was not given.
Tested with the regenerated configure:
--with-address-sanitizer --with-pymalloc now defines WITH_PYMALLOC, and
--with-address-sanitizer alone still leaves it undefined.

--with-address-sanitizer and --with-memory-sanitizer unconditionally
disabled pymalloc, even when --with-pymalloc was given explicitly.
Only apply the default when the user did not specify a preference.

@StanFromIreland StanFromIreland left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please also update the --with-address-sanitizer documentation, the note about --without-pymalloc is redundant.

Comment thread configure.ac Outdated
Comment thread configure.ac Outdated
StanFromIreland added a commit to StanFromIreland/cpython that referenced this pull request Sep 22, 2026
@read-the-docs-community

read-the-docs-community Bot commented Sep 22, 2026

Copy link
Copy Markdown

Documentation build overview

📚 cpython-previews | 🛠️ Build #34716258 | 📁 Comparing e0a51e2 against main (6757482)

  🔍 Preview build  

6 files changed · ± 6 modified

± Modified

@StanFromIreland StanFromIreland changed the title gh-136872: Let --with-pymalloc override the sanitizer default gh-136872: Let --with-pymalloc override the sanitizer default Sep 23, 2026

@StanFromIreland StanFromIreland left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a few more docs tweaks, we also need to update the note in the Memory Management documentation:

Typically, it makes sense to disable the pymalloc allocator when building
Python with AddressSanitizer (:option:`--with-address-sanitizer`) which helps
uncover low level bugs within the C code.

Comment thread Doc/using/configure.rst
Comment thread Doc/using/configure.rst
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants