Skip to content

wait_chain: call strategies positionally, accept WaitBaseT - #783

Open
tony1233200 wants to merge 1 commit into
jd:mainfrom
tony1233200:fix/780-wait-chain-positional
Open

tony1233200 wants to merge 1 commit into
jd:mainfrom
tony1233200:fix/780-wait-chain-positional

Conversation

@tony1233200

Copy link
Copy Markdown

Fixes #780.

wait_chain.__call__ passed retry_state as a keyword argument, so any plain callable wait strategy whose parameter is not named retry_state raised TypeError. wait_combine (and wait_fixed(0) + callable) already call the strategy positionally, so wait_chain was the odd one out.

  • Call the selected strategy positionally in wait_chain.__call__, with the same rationale comment as wait_combine.
  • Widen wait_chain.__init__ from *strategies: wait_base to *strategies: WaitBaseT, like wait_combine.
  • Regression test test_wait_chain_passes_state_positionally (a lambda rs: ... strategy as the second chain element).
  • Release note.

Verified: the issue reproduction now retries through my_wait instead of raising TypeError; tests/test_tenacity.py 143 passed, plus test_after/test_utils/test_issue_478 7 passed; ruff check and ruff format --check clean.

wait_chain passed retry_state as a keyword argument, so any plain
callable wait strategy whose parameter is not named retry_state raised
TypeError. Call it positionally, as wait_combine does, widen the
constructor to WaitBaseT, and add a regression test (fixes jd#780).
@mergify

mergify Bot commented Nov 21, 2026

Copy link
Copy Markdown
Contributor

Tick the box to add this pull request to the merge queue (same as @mergifyio queue). If it does not match the queue conditions yet, it enters the queue once it does.

  • Queue this pull request once it meets the queue conditions

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

wait_chain passes retry_state as keyword, breaking callable wait strategies

2 participants