Whole file

jd/tenacity

The author described this change as Fix async loop with retrying code block when result is available (#369). It counts as a record because the check below fails on the code as it stood at e1323a0e0 and passes on 0b1cef0be, with nothing else changed between the two runs.

Fix saved2023-01-30
Sharing licenceApache-2.0 · LICENSE
Change size+2 2

What the code was meant to do, written into the code itself as a save note

Fix async loop with retrying code block when result is available (#369)

The change

6464 self._retry_state = RetryCallState(self, fn=None, args=(), kwargs={})
6565 return self
6666
67- async def __anext__(self) -> typing.Union[AttemptManager, typing.Any]:
67+ async def __anext__(self) -> AttemptManager:
6868 while True:
6969 do = self.iter(retry_state=self._retry_state)
7070 if do is None:
7575 self._retry_state.prepare_for_next_attempt()
7676 await self.sleep(do)
7777 else:
78- return do
78+ raise StopAsyncIteration
7979
8080 def wraps(self, fn: WrappedFn) -> WrappedFn:
8181 fn = super().wraps(fn)

The check that tells the two apart

failpass·tests/test_asyncio.py::TestContextManager::test_retry_with_result

Check file tests/test_asyncio.py, taken without changes from the fix and copied onto the older code, so the exact same check runs against both versions.

Origin and history

The code before ite1323a0e0ff9f7d867d3632c3ebf582f446b0a91
Broken version dated2023-01-30
Moduletenacity._asyncio
Units changedAsyncRetrying
Fingerprint5084af4d65d58138
Checked2026-08-18 by goldset/0.1

Every field above is generated by our program. None of it is written by hand.

Other bugs found in jd/tenacity