From c7095d6854103210cac8781e22c4fd92ae0009cf Mon Sep 17 00:00:00 2001 From: Lidi Zheng Date: Wed, 5 Feb 2020 11:24:13 -0800 Subject: [PATCH] Make a proper shallow copy of onging calls set --- src/python/grpcio/grpc/experimental/aio/_channel.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/python/grpcio/grpc/experimental/aio/_channel.py b/src/python/grpcio/grpc/experimental/aio/_channel.py index 7035dd6c35e..9e9c7529f34 100644 --- a/src/python/grpcio/grpc/experimental/aio/_channel.py +++ b/src/python/grpcio/grpc/experimental/aio/_channel.py @@ -395,9 +395,10 @@ 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(data=self._ongoing_calls.calls) + calls = frozenset(self._ongoing_calls.calls) for call in calls: - call.cancel() + if call is not None: + call.cancel() self._channel.close()