Skip to content

Commit

Permalink
[Python AIO] Change default code() return to StatusCode.OK instead of…
Browse files Browse the repository at this point in the history
… None
  • Loading branch information
XuanWang-Amos committed Jan 4, 2024
1 parent b84d5ef commit 7e86c31
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/python/grpcio/grpc/_cython/_cygrpc/aio/server.pyx.pxi
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import inspect
import traceback
import functools

import grpc

cdef int _EMPTY_FLAG = 0
cdef str _RPC_FINISHED_DETAILS = 'RPC already finished.'
Expand Down Expand Up @@ -55,7 +56,7 @@ cdef class RPCState:
self.metadata_sent = False
self.status_sent = False
self.status_code = StatusCode.ok
self.py_status_code = None
self.py_status_code = grpc.StatusCode.OK
self.status_details = ''
self.trailing_metadata = _IMMUTABLE_EMPTY_METADATA
self.compression_algorithm = None
Expand Down
3 changes: 2 additions & 1 deletion src/python/grpcio_tests/tests_aio/unit/server_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,8 @@ def __init__(self):
}

@staticmethod
async def _unary_unary(unused_request, unused_context):
async def _unary_unary(unused_request, context):
assert context.code() == grpc.StatusCode.OK
return _RESPONSE

async def _block_forever(self, unused_request, unused_context):
Expand Down

0 comments on commit 7e86c31

Please sign in to comment.