Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Preserve escaped test data section lines#21774

Open
tarun-bandi wants to merge 1 commit into
python:masterpython/mypy:masterfrom
tarun-bandi:agent/preserve-update-data-escapestarun-bandi/mypy:agent/preserve-update-data-escapesCopy head branch name to clipboard
Open

Preserve escaped test data section lines#21774
tarun-bandi wants to merge 1 commit into
python:masterpython/mypy:masterfrom
tarun-bandi:agent/preserve-update-data-escapestarun-bandi/mypy:agent/preserve-update-data-escapesCopy head branch name to clipboard

Conversation

@tarun-bandi

Copy link
Copy Markdown

Fixes #17465.

parse_test_data() unescapes lines that begin with \[ so they can be treated as source text rather than .test section headers. When --update-data rewrites a test case, it was writing the parsed source line back directly, so an escaped line such as \[mypy] became [mypy] and could be parsed as a new section on the next run.

This keeps updated source lines escaped when they would otherwise look like section headers after being written back. It covers both unchanged lines in [file ...] sections and source lines that gain an inline # E: comment ending with an error code.

Validation:

  • /Users/bandi/Documents/Codex/2026-07-24/new-chat/work/mypy_venv/bin/python -m pytest mypy/test/test_update_data.py -q
  • PYTHONPYCACHEPREFIX=/Users/bandi/Documents/Codex/2026-07-24/new-chat/work/.pycache /Users/bandi/Documents/Codex/2026-07-24/new-chat/work/mypy_venv/bin/python -m py_compile mypy/test/update_data.py mypy/test/test_update_data.py
  • git diff --cached --check

@tarun-bandi
tarun-bandi force-pushed the agent/preserve-update-data-escapes branch from a27210e to 398a49e Compare July 25, 2026 04:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

(🐞) --update-data removes escapes

1 participant

Morty Proxy This is a proxified and sanitized view of the page, visit original site.