FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Dynamic Analysis with Clang building python make unittest failed · Issue #746 · python/devguide · GitHub

Repository navigation

Dynamic Analysis with Clang building python make unittest failed #746

Description

use this way to enable sanitizers make unittest check Sanitizer failed; it use _cflags to check

_cflags = sysconfig.get_config_var('CFLAGS') or ''
_config_args = sysconfig.get_config_var('CONFIG_ARGS') or ''
MEMORY_SANITIZER = (
    '-fsanitize=memory' in _cflags or
    '--with-memory-sanitizer' in _config_args
)

ADDRESS_SANITIZER = (
    '-fsanitize=address' in _cflags
)

should replace with configure option

  --with-address-sanitizer
                          enable AddressSanitizer memory error detector,
                          'asan' (default is no)
  --with-memory-sanitizer enable MemorySanitizer allocation error detector,
                          'msan' (default is no)
  --with-undefined-behavior-sanitizer
                          enable UndefinedBehaviorSanitizer undefined
                          behaviour detector, 'ubsan' (default is no)

Activity

  1. changed the title [-]Dynamic Analysis with Clang[/-] [+]Dynamic Analysis with Clang building python make unittest failed[/+] on Sep 14, 2021
  2. encukou commented on Oct 7, 2026

    Member

    I'm not sure I understand this issue. Perhaps the code & docs changed too much since 2021.

    Sanitizers are a tool for finding bugs, which they are likely to do if you run them in different configurations/platforms than the CI.
    Please feel free to report the bugs.

  3. StanFromIreland commented on Oct 7, 2026

    Member

    The section is still there, and it's a little confusing, it notes:

    Some parts of Python (for example, _testembed, _freeze_importlib, test_cppext) may not use the variables set by configure, and with the above settings they’ll be compiled without sanitization.

    This seems outdated as the --with-*-sanitizer config options already put -fsanitize=... into BASECFLAGS/LDFLAGS, which all build rules use, so nothing is left unsanitised and the workaround solves a non-existent problem.

  4. StanFromIreland commented on Oct 7, 2026

    Member

    Really, the whole section is a little dated I think we can rework it into a (compiler-neutral) "Sanitizers" page that covers ASan, UBSan, TSan, MSan and HWAsan, and documentst things like our runtime suppression files (which we have for our CI jobs).

  5. encukou commented on Oct 8, 2026

    Member

    Thanks for taking this on. I wanted to track the update in a different issue :)

    It might be worth noting that the guide might be both outdated (this stuff changes surprisingly fast!) and not applicable to older branches (figuring out when the workaround got unnecessary probably isn't worth it).

  6. encukou commented on Oct 8, 2026

    Member

    pymalloc stuff is also outdated. Maybe all of "Python build setup" should just be a link to the --with-*-sanitizer options in main docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


    Back | FazBrowse Home | New Git URL