Skip to content

Commit 7f00778

Browse files
d-w-moorealanking
authored andcommitted
[#315] skip cleanup() if session.pool is None
An uninitiated session (represented by an iRODSSession object with pool attribute of None) was, upon deletion, calling cleanup() despite having no connections (idle or active) to clean up. This corrects the bug and prevents the error message that was spooling to the console as a result.
1 parent 000b3ec commit 7f00778

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

irods/session.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,10 @@ def __exit__(self, exc_type, exc_value, traceback):
5858

5959
def __del__(self):
6060
self.do_configure = {}
61-
self.cleanup()
61+
# If self.pool has been fully initialized (ie. no exception was
62+
# raised during __init__), then try to clean up.
63+
if self.pool is not None:
64+
self.cleanup()
6265

6366
def cleanup(self):
6467
for conn in self.pool.active | self.pool.idle:

0 commit comments

Comments
 (0)