Remove assertions & add a comment

pull/21803/head
Lidi Zheng 5 years ago
parent 1b92dc0a7e
commit a63f51b1ad
  1. 3
      src/python/grpcio/grpc/_cython/_cygrpc/aio/call.pyx.pxi
  2. 1
      src/python/grpcio/grpc/experimental/aio/_call.py

@ -411,7 +411,6 @@ cdef class _AioCall(GrpcCallWrapper):
except ExecuteBatchError as batch_error: except ExecuteBatchError as batch_error:
# Core should explain why this batch failed # Core should explain why this batch failed
await status_task await status_task
assert self._status.code() != StatusCode.ok
async def stream_unary(self, async def stream_unary(self,
tuple outbound_initial_metadata, tuple outbound_initial_metadata,
@ -438,7 +437,6 @@ cdef class _AioCall(GrpcCallWrapper):
except ExecuteBatchError: except ExecuteBatchError:
# Core should explain why this batch failed # Core should explain why this batch failed
await self._handle_status_once_received() await self._handle_status_once_received()
assert self._status.code() != StatusCode.ok
# Allow upper layer to proceed only if the status is set # Allow upper layer to proceed only if the status is set
metadata_sent_observer() metadata_sent_observer()
@ -498,7 +496,6 @@ cdef class _AioCall(GrpcCallWrapper):
except ExecuteBatchError as batch_error: except ExecuteBatchError as batch_error:
# Core should explain why this batch failed # Core should explain why this batch failed
await status_task await status_task
assert self._status.code() != StatusCode.ok
# Allow upper layer to proceed only if the status is set # Allow upper layer to proceed only if the status is set
metadata_sent_observer() metadata_sent_observer()

@ -171,6 +171,7 @@ class Call:
self._response_deserializer = response_deserializer self._response_deserializer = response_deserializer
def __del__(self) -> None: def __del__(self) -> None:
# The '_cython_call' object might be destructed before Call object
if hasattr(self, '_cython_call'): if hasattr(self, '_cython_call'):
if not self._cython_call.done(): if not self._cython_call.done():
self._cancel(_GC_CANCELLATION_DETAILS) self._cancel(_GC_CANCELLATION_DETAILS)

Loading…
Cancel
Save