diff --git a/src/python/grpcio/grpc/experimental/aio/_channel.py b/src/python/grpcio/grpc/experimental/aio/_channel.py index 536206241fe..7035dd6c35e 100644 --- a/src/python/grpcio/grpc/experimental/aio/_channel.py +++ b/src/python/grpcio/grpc/experimental/aio/_channel.py @@ -395,10 +395,9 @@ class Channel: # A new set is created acting as a shallow copy because # when cancellation happens the calls are automatically # removed from the originally set. - calls = WeakSet(self._ongoing_calls.calls) + calls = WeakSet(data=self._ongoing_calls.calls) for call in calls: - if call is not None: - call.cancel() + call.cancel() self._channel.close()