Skip to content

Commit ed2f758

Browse files
authored
Merge pull request kragniz#978 from ahmedbilal/patch-2
Don't close grpcio channel when it don't exist
2 parents 491a709 + 9c3d8da commit ed2f758

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

etcd3/client.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,8 @@ def __init__(self, host='localhost', port=2379,
170170

171171
def close(self):
172172
"""Call the GRPC channel close semantics."""
173-
self.channel.close()
173+
if hasattr(self, 'channel'):
174+
self.channel.close()
174175

175176
def __enter__(self):
176177
return self

0 commit comments

Comments
 (0)