Guard _ChannelCallState.__del__ from cygrpc being deallocated early

pull/23291/head
Lidi Zheng 5 years ago
parent cbcc2bb185
commit ecc8aa8a71
  1. 3
      src/python/grpcio/grpc/_channel.py

@ -1123,7 +1123,8 @@ class _ChannelCallState(object):
self.managed_calls = 0
def __del__(self):
if hasattr(self, 'channel') and self.channel:
if hasattr(self,
'channel') and self.channel and cygrpc and cygrpc.StatusCode:
self.channel.close(cygrpc.StatusCode.cancelled,
'Channel deallocated!')

Loading…
Cancel
Save