Avoid AttributeErrors in _unregister_cleanup (#747)

This commit is contained in:
Dana Powers
2016-07-05 22:59:03 -07:00
committed by GitHub
parent 114bfa8767
commit 75ee7fd06d

View File

@@ -314,7 +314,7 @@ class KafkaProducer(object):
return wrapper
def _unregister_cleanup(self):
if getattr(self, '_cleanup'):
if getattr(self, '_cleanup', None):
if hasattr(atexit, 'unregister'):
atexit.unregister(self._cleanup) # pylint: disable=no-member