Repository navigation
Honor false-valued callable wait strategies - #731
Closed
sricharanreddycheruku wants to merge 1 commit into
Closed
sricharanreddycheruku wants to merge 1 commit into
sricharanreddycheruku wants to merge 1 commit into
Conversation
sricharanreddycheruku
force-pushed
the
fix-falsey-wait-callables
branch
from
October 7, 2026 03:55
c754134 to
b553e21
Compare
Owner
|
Thanks for spotting this. I went with a different shape in #741: instead of casting |
mergify Bot
pushed a commit
that referenced
this pull request
Oct 7, 2026
BaseRetrying skipped the wait strategy whenever it was falsy, so a callable strategy that is an empty container or defines __bool__ was never called. Match the "no wait" values (None, 0, and sum([]) over no strategies) explicitly, and replace them with wait_none() at construction so both the sync and async loops just call the strategy. This drops the truthy-bool type: ignore in both _run_wait. Supersedes #731. Change-Id: Ic5b013f36c168a6c387ad912840c4ab944c72f4b Co-authored-by: Claude Opus 5.5 <[email protected]>
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.
A callable
waitobject whose__bool__returns false or whose__len__is zero is currently skipped by bothRetryingandAsyncRetrying. Retries then use zero delay instead of the wait strategy's return value.Check whether the setting is callable before evaluating its truth value. Callable strategies are always invoked; false-valued non-callables such as
Noneand0continue to disable waiting, and truthy invalid settings still raiseTypeError.Adds regression tests through the public retry controllers for synchronous and asynchronous wait callables, zero-length callables, callables whose truth test raises, and compatibility with existing no-wait settings. Includes a Reno release note.
Validation on Python 3.12.14:
uv run poe allpasses: 199 tests, Ruff lint and formatting, strict mypy, 35 documentation doctests, and the HTML documentation build with warnings treated as errors.uv run reno lintandgit diff --checkpass.