Skip to content

Default the warning checker's optional path prefix to an empty string #159338

Closed as not planned

Description

@esadomer

The optional --path-prefix argument of Tools/build/check_warnings.py defaults to None. Parsing a warning then calls str.removeprefix(None), so the tool fails unless a prefix is supplied.

Reproducer, run with the interpreter built from the CPython checkout:

import subprocess
import sys
import tempfile
from pathlib import Path

with tempfile.TemporaryDirectory() as directory:
    output = Path(directory, 'compiler.txt')
    output.write_text(
        'source.c:1:2: warning: example [-Wunused]\n', encoding='utf-8')
    subprocess.run([
        sys.executable, 'Tools/build/check_warnings.py',
        '-c', str(output), '-t', 'gcc',
    ])

Expected: Omitting the optional prefix leaves file paths unchanged and the tool finishes normally.

Observed: A TypeError reports that the argument to removeprefix() must be a string, not None.

Environment: CPython main, Windows debug build.

Linked PRs

Activity

  1. added a commit that references this issue on Oct 13, 2026
  2. added
    pendingThe issue will be closed if no feedback is provided
    on Oct 14, 2026
  3. picnixz commented on Oct 14, 2026

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    pendingThe issue will be closed if no feedback is provided

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions