Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d99917f

Browse files
committed
safety check in __del__
1 parent 200a3bb commit d99917f

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

flask_hypertable/flask_hypertable.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,8 @@ def init_app(self, app):
6767
app.teardown_request(self.teardown)
6868

6969
def __del__(self):
70-
self.close_app()
70+
if self:
71+
self.close_app()
7172

7273
def close_app(self):
7374
""" shutdowns this instance, releasing the connection pool """
@@ -230,7 +231,8 @@ def close(self):
230231
ThriftClient.close(self)
231232

232233
def __del__(self):
233-
self.close()
234+
if self:
235+
self.close()
234236

235237

236238
class ManagedNamespaces(object):

0 commit comments

Comments
 (0)