diff --git a/src/python/grpcio/grpc/_cython/_cygrpc/aio/call.pyx.pxi b/src/python/grpcio/grpc/_cython/_cygrpc/aio/call.pyx.pxi index e74b4e6ba05..289fce4c303 100644 --- a/src/python/grpcio/grpc/_cython/_cygrpc/aio/call.pyx.pxi +++ b/src/python/grpcio/grpc/_cython/_cygrpc/aio/call.pyx.pxi @@ -411,7 +411,6 @@ cdef class _AioCall(GrpcCallWrapper): except ExecuteBatchError as batch_error: # Core should explain why this batch failed await status_task - assert self._status.code() != StatusCode.ok async def stream_unary(self, tuple outbound_initial_metadata, @@ -438,7 +437,6 @@ cdef class _AioCall(GrpcCallWrapper): except ExecuteBatchError: # Core should explain why this batch failed await self._handle_status_once_received() - assert self._status.code() != StatusCode.ok # Allow upper layer to proceed only if the status is set metadata_sent_observer() @@ -498,7 +496,6 @@ cdef class _AioCall(GrpcCallWrapper): except ExecuteBatchError as batch_error: # Core should explain why this batch failed await status_task - assert self._status.code() != StatusCode.ok # Allow upper layer to proceed only if the status is set metadata_sent_observer() diff --git a/src/python/grpcio/grpc/experimental/aio/_call.py b/src/python/grpcio/grpc/experimental/aio/_call.py index d09eb3b5e08..6f976411e5f 100644 --- a/src/python/grpcio/grpc/experimental/aio/_call.py +++ b/src/python/grpcio/grpc/experimental/aio/_call.py @@ -171,6 +171,7 @@ class Call: self._response_deserializer = response_deserializer def __del__(self) -> None: + # The '_cython_call' object might be destructed before Call object if hasattr(self, '_cython_call'): if not self._cython_call.done(): self._cancel(_GC_CANCELLATION_DETAILS)