Skip to content

Conversation

RobinMcCorkell
Copy link
Contributor

Follow up to #14785

ClientInterceptors should not be generic over request/response themselves, but rather should have generic methods: a given instance of this should be able to intercept any call, and so should have a generic method over all request/continuation types rather than the instance being specialized itself.

I also fixed the continuation/return types on the client interceptors which were incorrect:

  • The type of the second parameter to the continuation should be identical to the request/iterator given to the intercept call
  • The return type of the continuation should be identical to the return type of the intercept call
  • aio interceptor continuations are always Awaitable

The new tests demonstrate the correct usage.

Fixes: #14641

@RobinMcCorkell
Copy link
Contributor Author

@srittau one more for you :)

Copy link
Contributor

github-actions bot commented Oct 4, 2025

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

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.

grpcio: Interceptor base classes are incompatible with mypy --disallow-any-generics or --strict options
1 participant