Skip to content

Commit

Permalink
Merge pull request grpc#23291 from lidizheng/v1.30.x-patch-2
Browse files Browse the repository at this point in the history
Backport: Avoid attribute error in __del__ of _ChannelCallState
  • Loading branch information
srini100 authored Jun 24, 2020
2 parents 9655f1f + ecc8aa8 commit 9a122e5
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/python/grpcio/grpc/_channel.py
Original file line number Diff line number Diff line change
Expand Up @@ -1123,7 +1123,10 @@ def reset_postfork_child(self):
self.managed_calls = 0

def __del__(self):
self.channel.close(cygrpc.StatusCode.cancelled, 'Channel deallocated!')
if hasattr(self,
'channel') and self.channel and cygrpc and cygrpc.StatusCode:
self.channel.close(cygrpc.StatusCode.cancelled,
'Channel deallocated!')


def _run_channel_spin_thread(state):
Expand Down

0 comments on commit 9a122e5

Please sign in to comment.