Guard _ChannelCallState.__del__ from cygrpc being deallocated early

This commit is contained in:
Lidi Zheng 2020-06-12 13:07:23 -07:00
parent c47bc1a709
commit 72f2b99097
1 changed files with 2 additions and 1 deletions

View File

@ -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!')