GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — [PR #14220/680f9f3e backport][9.1.x] raises: fix stale loop variable in RaisesGroup error reporting by patchback[bot] · Pull Request #14620 · pytest-dev/pytest

Conversation

@patchback

@patchback patchback Bot commented Jun 17, 2026

Copy link
Copy Markdown

This is a backport of PR #14220 as merged into main (680f9f3).

In RaisesGroup._check_exceptions, the diagnostic section that builds failure messages for unmatched expected exceptions has a bug on this line:

for i_failed in failed_expected:
    s += (
        f"\n{indent_1}{self._repr_expected(self.expected_exceptions[i_failed])}"
    )
    for i_actual, actual in enumerate(actual_exceptions):
        if results.get_result(i_exp, i_actual) is None:  # <-- bug

i_exp here is a leftover from the earlier for i_exp, expected in enumerate(self.expected_exceptions): loop that computes the full results matrix. By the time we reach this diagnostic loop, i_exp holds whatever value it had when that earlier loop finished -- it doesn't track the current i_failed iteration at all.

This means the results.get_result(i_exp, i_actual) call looks up the wrong expected exception's result, so the "It matches ... which was paired with ..." hints in the failure output can be completely wrong or missing.

Fix: replace i_exp with i_failed, which is the actual loop variable for the current expected exception being reported.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@bluetech @patchback
Merge pull request #14220 from bysiber/fix-stale-iexp-raisesgroup
66abd07
raises: fix stale loop variable in RaisesGroup error reporting
(cherry picked from commit 680f9f3)
@patchback patchback Bot mentioned this pull request Jun 17, 2026
raises: fix stale loop variable in RaisesGroup error reporting #14220
Merged
bluetech
bluetech approved these changes Jun 17, 2026
View reviewed changes
@bluetech
bluetech merged commit ef8b299 into 9.1.x Jun 17, 2026
34 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@bluetech
bluetech deleted the patchback/backports/9.1.x/680f9f3ed3faaaa9a4fd1d8120618cd17cdee2d0/pr-14220 branch June 17, 2026 14:56
@rennerdo30 rennerdo30 mentioned this pull request Oct 21, 2026
[Historical PR] chore(deps-dev): update pytest requirement from >=8.4.2 to >=9.1.1 rennerdo30/pdf-translator#22
Closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@bluetech bluetech bluetech approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

1 participant

@bluetech
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.