Title: The configure script doesn't allow running ASan with PyMalloc · Issue #136872 · python/cpython · GitHub
Open Graph Title: The configure script doesn't allow running ASan with PyMalloc · Issue #136872 · python/cpython
X Title: The configure script doesn't allow running ASan with PyMalloc · Issue #136872 · python/cpython
Description: Bug report Bug description: The --with-address-sanitizer configure option overrides whatever pymalloc option one provides which it should not. We should either allow it to work with --with-pymalloc, or, delete the line that disables pyma...
Open Graph Description: Bug report Bug description: The --with-address-sanitizer configure option overrides whatever pymalloc option one provides which it should not. We should either allow it to work with --with-pymalloc...
X Description: Bug report Bug description: The --with-address-sanitizer configure option overrides whatever pymalloc option one provides which it should not. We should either allow it to work with --with-pymalloc...
Opengraph URL: https://github.com/python/cpython/issues/136872
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"The configure script doesn't allow running ASan with PyMalloc","articleBody":"# Bug report\n\n### Bug description:\n\nThe `--with-address-sanitizer` configure option overrides whatever pymalloc option one provides which it should not.\n\nWe should either allow it to work with `--with-pymalloc`, or, delete the line that disables pymalloc. I discussed it a bit during EP2025 sprint with @encukou .\n\nThis is done due to the line here:\nhttps://github.com/python/cpython/blame/4a151cae3317ce133bdf0792fb1064c5030e588c/configure#L13352\n\nI believe that CPython works fine with ASan + PyMalloc. I have tested it by removing the line above. Then the `import _testcapi; _testcapi.WITH_PYMALLOC` is `True` and there doesn't seem to be ASan crashes. However, there are leaks being detected, even when building Python, so I did all this with `export ASAN_OPTIONS=detect_leaks=0`.\n\nIt is also worth noting that we:\n1. List the `--without-pymalloc` flag in the [devguide](https://github.com/python/devguide/blob/2fad8516e646a9ceedd32566587f7200b1610649/development-tools/clang.rst#:~:text=The%20%2D%2Dwithout%2Dpymalloc%20option%20is%20not%20necessary%20(tests%20should%20pass%20without%20it)%2C%20but%20disabling%20pymalloc%20helps%20ASan%20uncover%20more%20bugs%20(ASan%20does%20not%20track%20individual%20allocations%20done%20by%20pymalloc).) when showing how to run ASan.\n2. We mention there, that the flag is not necessary, but it makes ASan more effective.\n3. We mention in CPython docs that it makes sense to disable PyMalloc when running ASan [here](https://github.com/python/cpython/blob/main/Doc/c-api/memory.rst#:~:text=Typically%2C%20it%20makes%20sense%20to%20disable%20the%20pymalloc%20allocator%20when%20building%20Python%20with%20AddressSanitizer%20(%3Aoption%3A%60%2D%2Dwith%2Daddress%2Dsanitizer%60)%20which%20helps%20uncover%20low%20level%20bugs%20within%20the%20C%20code.)\n\n \n\n### CPython versions tested on:\n\nCPython main branch\n\n### Operating systems tested on:\n\n_No response_\n\n\u003c!-- gh-linked-prs -->\n### Linked PRs\n* gh-157934\n\u003c!-- /gh-linked-prs -->\n","author":{"url":"https://github.com/disconnect3d","@type":"Person","name":"disconnect3d"},"datePublished":"2025-07-20T13:22:58Z","url":"https://github.com/python/cpython/issues/136872"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:23fb0640-3023-3787-b527-849a1c793833 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8194:1FAE:127A931:18B05EE:6B022043 |
| html-safe-nonce | 3b8489dfc512f3df04aa0484a8242a6c85fa184e27986f36858fc1aa9764f2cd |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4MTk0OjFGQUU6MTI3QTkzMToxOEIwNUVFOjZCMDIyMDQzIiwidmlzaXRvcl9pZCI6IjY0NDk2MzE1ODg5MjYxNzc5NSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 891e252f20edbed8d019f39dcf5723030c81161e2f30d2105499b3b866b1e013 |
| hovercard-subject-tag | issue:3246353687 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python/cpython/136872/issue_layout |
| twitter:image | https://opengraph.githubassets.com/439da473ae9d9958415ee61bca22305e850b41ef182857ca188c858fb4fc596d/python/cpython/issues/136872 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/439da473ae9d9958415ee61bca22305e850b41ef182857ca188c858fb4fc596d/python/cpython/issues/136872 |
| og:image:alt | Bug report Bug description: The --with-address-sanitizer configure option overrides whatever pymalloc option one provides which it should not. We should either allow it to work with --with-pymalloc... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | disconnect3d |
| hostname | github.com |
| expected-hostname | github.com |
| None | 87e774ee7c6b3bee0490394e4d3e57ec9dbc956f74b87ea685dc8996c1676456 |
| turbo-cache-control | no-preview |
| go-import | github.com/python/cpython git https://github.com/python/cpython.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 81598961 |
| octolytics-dimension-repository_nwo | python/cpython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 81598961 |
| octolytics-dimension-repository_network_root_nwo | python/cpython |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 423dbb54c5e7bfecc838eb387c1435eb3d0e760d |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width