Avoid attribute error in __del__ from _ChannelCallState

pull/23176/head
Lidi Zheng 5 years ago
parent 80e834abab
commit 7294172c8f
  1. 4
      src/python/grpcio/grpc/_channel.py

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

Loading…
Cancel
Save