Conversation
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
When an exception is raised inside an except block without an explicit
raise ... from ..., Python stores the in-flight exception in context and leaves cause as None. retry_if_exception_cause_type only inspected cause, so such implicitly chained exceptions were never retried even when the underlying cause type matched, even though tracebacks render the chain ("During handling of the above exception, another exception occurred"). The predicate now falls back to context when no explicit cause is set and the context was not suppressed withraise ... from None, so both spellings behave identically.Users writing
except SomeError: raise WrapperError(...)(nofrom) reasonably expect retry_if_exception_cause_type(SomeError) to keep retrying, exactly as the explicitfrom SomeErrorform does. The implicit form is the more common spelling in application code, so the predicate silently skipped retries in exactly those cases. Related to issue #625 (retry_unless_exception_cause_type feature request): an inverted predicate would inherit this same gap, so fixing the cause-chain traversal in the existing class grounds both.Validation: a new regression test fails on the unchanged base and passes with this patch; reproduced in an independent clean checkout.
Full-suite results (including pre-existing failures, if any):
{ "base": { "exit": 1, "tests": 203, "failures": 1, "errors": 0, "skipped": 0, "failed_cases": [ "tests.test_retry_if_exception_cause_type_context.test_implicit_context_chain_is_retried" ] }, "patch": { "exit": 0, "tests": 203, "failures": 0, "errors": 0, "skipped": 0, "failed_cases": [] } }AI assistance: implementation and review used Hermes with self-hosted GLM 5.3. Automated test evidence was checked separately. This does not represent a human review.
Additional checks were reproduced on fresh base and patched checkouts: