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.
Projectjd/tenacity
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
| 64 | 64 | self._retry_state = RetryCallState(self, fn=None, args=(), kwargs={}) | |
| 65 | 65 | return self | |
| 66 | 66 | ||
| 67 | - | async def __anext__(self) -> typing.Union[AttemptManager, typing.Any]: | |
| 67 | + | async def __anext__(self) -> AttemptManager: | |
| 68 | 68 | while True: | |
| 69 | 69 | do = self.iter(retry_state=self._retry_state) | |
| 70 | 70 | if do is None: | |
| ⋯ | |||
| 75 | 75 | self._retry_state.prepare_for_next_attempt() | |
| 76 | 76 | await self.sleep(do) | |
| 77 | 77 | else: | |
| 78 | - | return do | |
| 78 | + | raise StopAsyncIteration | |
| 79 | 79 | ||
| 80 | 80 | def wraps(self, fn: WrappedFn) -> WrappedFn: | |
| 81 | 81 | fn = super().wraps(fn) | |
The check that tells the two apart
fail→pass·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.