Avoid attribute error in __del__ from _ChannelCallState

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

@ -1123,7 +1123,9 @@ class _ChannelCallState(object):
self.managed_calls = 0 self.managed_calls = 0
def __del__(self): 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): def _run_channel_spin_thread(state):

Loading…
Cancel
Save