Switch to using getattr in qpid.Transport.__del__ (#658)

The __init__ function calls verify_runtime_environment before setting
the use_async_interface variable.  If it throws an exception in that
function, the __del__ method will be called, and raises an
AttributeError

using getattr in the __del__ method to guard against this
This commit is contained in:
Patrick Creech 2016-11-30 10:13:44 -05:00 committed by Asif Saifuddin Auvi
parent 7e1e06b0f9
commit 82f026eafa
1 changed files with 1 additions and 1 deletions

View File

@ -1731,7 +1731,7 @@ class Transport(base.Transport):
def __del__(self):
"""Ensure file descriptors opened in __init__() are closed."""
if self.use_async_interface:
if getattr(self, 'use_async_interface', False):
for fd in (self.r, self._w):
try:
os.close(fd)