Skip to content

Fix off-by-one in trailing assertion diff skipping (#14637)#14639

Open
Aditya-Tripuraneni wants to merge 2 commits into
pytest-dev:mainfrom
Aditya-Tripuraneni:fix-14637-trailing-skip-off-by-one
Open

Fix off-by-one in trailing assertion diff skipping (#14637)#14639
Aditya-Tripuraneni wants to merge 2 commits into
pytest-dev:mainfrom
Aditya-Tripuraneni:fix-14637-trailing-skip-off-by-one

Conversation

@Aditya-Tripuraneni

@Aditya-Tripuraneni Aditya-Tripuraneni commented Jun 22, 2026

Copy link
Copy Markdown

Closes #14637

Fix an off-by-one in trailing text diff skipping so pytest compares from the last character first instead of accidentally checking the first character via -0.

This adds a regression test for the case where the compared strings differ at the beginning but share a long identical trailing suffix, and includes a changelog entry.

Thanks to @EternalRights for finding and reporting this bug.

@psf-chronographer psf-chronographer Bot added the bot:chronographer:provided (automation) changelog entry is part of PR label Jun 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bot:chronographer:provided (automation) changelog entry is part of PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

assertion diff: trailing character skip fails when first characters differ (off-by-one in left[-i] when i=0)

1 participant