Skip to content

feat: support retrying generator and async generator functions#610

Closed
jd wants to merge 1 commit intomainfrom
devs/jd/feat/generator-retry/Ie49981e21ff7cae602b69e63c567d007d8b78a65
Closed

feat: support retrying generator and async generator functions#610
jd wants to merge 1 commit intomainfrom
devs/jd/feat/generator-retry/Ie49981e21ff7cae602b69e63c567d007d8b78a65

Conversation

@jd
Copy link
Owner

@jd jd commented Feb 24, 2026

Fixes #63

Add retry support for sync and async generator functions. When a
generator decorated with @Retry raises an exception, the retry logic
kicks in and re-calls the generator function, continuing to yield
values from the new generator.

  • Add is_generator_callable() and is_async_gen_callable() detection
    utilities in _utils.py
  • Add sync generator wrapper in BaseRetrying.wraps()
  • Add async generator wrapper in AsyncRetrying.wraps()
  • Route async generators to AsyncRetrying in retry()

Co-Authored-By: Claude Opus 4.6 noreply@anthropic.com

Fixes #63

Add retry support for sync and async generator functions. When a
generator decorated with @Retry raises an exception, the retry logic
kicks in and re-calls the generator function, continuing to yield
values from the new generator.

- Add is_generator_callable() and is_async_gen_callable() detection
  utilities in _utils.py
- Add sync generator wrapper in BaseRetrying.wraps()
- Add async generator wrapper in AsyncRetrying.wraps()
- Route async generators to AsyncRetrying in retry()

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Change-Id: Ie49981e21ff7cae602b69e63c567d007d8b78a65
@jd jd closed this Feb 24, 2026
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.

Retry for Asynchronous Generator (PEP 525)

1 participant