Suppress exceptions from the __del__ of channel object

pull/23351/head
Lidi Zheng 5 years ago
parent 2a38879379
commit de075024a7
  1. 6
      src/python/grpcio/grpc/_channel.py

@ -1123,10 +1123,12 @@ class _ChannelCallState(object):
self.managed_calls = 0
def __del__(self):
if hasattr(self,
'channel') and self.channel and cygrpc and cygrpc.StatusCode:
try:
self.channel.close(cygrpc.StatusCode.cancelled,
'Channel deallocated!')
except (TypeError, AttributeError) as error:
logging.debug('Channel deallocation failed with: <%s>: %s',
type(error), str(error))
def _run_channel_spin_thread(state):

Loading…
Cancel
Save