Skip to content

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

Open
Aditya-Tripuraneni wants to merge 3 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 3 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
@Aditya-Tripuraneni Aditya-Tripuraneni force-pushed the fix-14637-trailing-skip-off-by-one branch from a06ffb0 to 71f3403 Compare June 23, 2026 16:50
@Aditya-Tripuraneni

Copy link
Copy Markdown
Author

@RonnyPfannschmidt could I please get a reviewal for this?

@RonnyPfannschmidt RonnyPfannschmidt left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good work thanks

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)

3 participants