Fix accessing DMatrix.handle before set. (#3599)

Close #3597.
This commit is contained in:
trivialfis 2018-08-17 06:26:06 +08:00 committed by Philip Hyunsu Cho
parent 725f4c36f2
commit 7c82dc92b2

View File

@ -479,7 +479,7 @@ class DMatrix(object):
nthread))
def __del__(self):
if self.handle is not None:
if hasattr(self, "handle") and self.handle is not None:
_check_call(_LIB.XGDMatrixFree(self.handle))
self.handle = None