File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed
Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -462,9 +462,12 @@ async def _handle_response(self, message: SessionMessage) -> None:
462462 """
463463 root = message .message .root
464464
465- # Type guard: this method is only called for responses/errors
466- if not isinstance (root , JSONRPCResponse | JSONRPCError ): # pragma: no cover
467- return
465+ # This check is always true at runtime: the caller (_receive_loop) only invokes
466+ # this method in the else branch after checking for JSONRPCRequest and
467+ # JSONRPCNotification. However, the type checker can't infer this from the
468+ # method signature, so we need this guard for type narrowing.
469+ if not isinstance (root , JSONRPCResponse | JSONRPCError ):
470+ return # pragma: no cover
468471
469472 response_id : RequestId = root .id
470473
You can’t perform that action at this time.
0 commit comments