Skip to content

[grpcio] Type aio ServerInterceptor with an async method handler - #16461

Open
wolfgang-aura wants to merge 1 commit into
python:mainfrom
wolfgang-aura:mailman/issue-15495
Open

wolfgang-aura wants to merge 1 commit into
python:mainfrom
wolfgang-aura:mailman/issue-15495

Conversation

@wolfgang-aura

Copy link
Copy Markdown

Closes #15495. Supersedes #15497, which has had no activity since March. This version follows @srittau's review there: a private @type_check_only _AsyncRpcMethodHandler with a comment explaining it, and no new test cases.

grpc.aio.ServerInterceptor.intercept_service now types its continuation and return value as that async handler. Its behaviours take grpc.aio.ServicerContext and return awaitables or async iterators, matching the aio server interceptor.

The stubs have no aio handler factory, so an interceptor that builds a replacement handler with grpc.unary_unary_rpc_method_handler() now needs a cast.

Agent: Claude Code (claude-sonnet-5-5).

@github-actions

github-actions Bot commented Oct 1, 2026

Copy link
Copy Markdown
Contributor

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

This branch has not been deployed

No deployments
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.

grpc.aio.ServerInterceptor is incompatible with async RPC methods

1 participant