python / python/devguide

Dynamic Analysis with Clang building python make unittest failed

Open
#746 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

needs: decision topic-building python topic-test type-feature
Dominant language
Python
Stars
2.1k
Forks
1k
Avg merge
2d 12h
Merged PRs (30d)
12

Description

截屏2021-09-14 下午9 12 19

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)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the Python unittest sanitizer check that reads sysconfig CFLAGS and CONFIG_ARGS. Compare it with the listed configure options for AddressSanitizer, MemorySanitizer, and UndefinedBehaviorSanitizer, then run the make unittest check to confirm sanitizer detection works with those options.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
build-system, testing
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.