Skip to content

Conversation

@Zac-HD
Copy link
Contributor

@Zac-HD Zac-HD commented Feb 6, 2026

Closes #553.

Comment on lines 588 to 593
@t.overload
def __call__(self, fn: t.Callable[P, types.CoroutineType[t.Any, t.Any, R]]) -> t.Callable[P, types.CoroutineType[t.Any, t.Any, R]]: ...
@t.overload
def __call__(self, fn: t.Callable[P, t.Coroutine[t.Any, t.Any, R]]) -> t.Callable[P, t.Coroutine[t.Any, t.Any, R]]: ...
@t.overload
def __call__(self, fn: t.Callable[P, t.Awaitable[R]]) -> t.Callable[P, t.Awaitable[R]]: ...
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typing.Coroutine == types.CoroutineType at runtime, but pyright distinguishes them by name and so I've provided separate overloads for them in addition to the wider Awaitable type.

Comment on lines +594 to +595
@t.overload
def __call__(self, fn: t.Callable[P, R]) -> t.Callable[P, t.Awaitable[R]]: ...
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and then this is the "if wasn't a coroutine function or otherwise returning an awaitable, it is now" annotation

@mergify mergify bot merged commit d4e868d into jd:main Feb 7, 2026
9 checks passed
@mergify
Copy link
Contributor

mergify bot commented Feb 7, 2026

Merge Queue Status

✅ The pull request has been merged at 399b08c

This pull request spent 4 seconds in the queue, with no time running CI.
The checks were run in-place.

Required conditions to merge

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.

tenacity.retry(sleep=...) fails type-checking with async sleep function

2 participants