From 1b293064f6a4669a997eb8b21b3b9de3a1c9cf72 Mon Sep 17 00:00:00 2001 From: Zach Riggle Date: Sat, 9 May 2015 16:06:48 -0400 Subject: [PATCH] Fix error when _cs is None during teardown --- bindings/python/capstone/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bindings/python/capstone/__init__.py b/bindings/python/capstone/__init__.py index 78ab9286..80bd42a6 100644 --- a/bindings/python/capstone/__init__.py +++ b/bindings/python/capstone/__init__.py @@ -728,7 +728,7 @@ class Cs(object): # destructor to be called automatically when object is destroyed. def __del__(self): - if self.csh: + if self.csh and _cs is not None: status = _cs.cs_close(ctypes.byref(self.csh)) if status != CS_ERR_OK: raise CsError(status)