Merge pull request #23351 from lidizheng/silence-del

Suppress exceptions from the __del__ of channel object
pull/23419/head
Lidi Zheng 4 years ago committed by GitHub
commit e1b4a5507c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  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