python: shared library can be unloaded from under our feet. issue reported by @joelpx
This commit is contained in:
parent
e42aaffb8d
commit
8ac478bd4b
|
@ -692,10 +692,13 @@ class Cs(object):
|
||||||
|
|
||||||
# destructor to be called automatically when object is destroyed.
|
# destructor to be called automatically when object is destroyed.
|
||||||
def __del__(self):
|
def __del__(self):
|
||||||
if self.csh and _cs is not None:
|
if self.csh:
|
||||||
|
try:
|
||||||
status = _cs.cs_close(ctypes.byref(self.csh))
|
status = _cs.cs_close(ctypes.byref(self.csh))
|
||||||
if status != CS_ERR_OK:
|
if status != CS_ERR_OK:
|
||||||
raise CsError(status)
|
raise CsError(status)
|
||||||
|
except: # _cs might be pulled from under our feet
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
# def option(self, opt_type, opt_value):
|
# def option(self, opt_type, opt_value):
|
||||||
|
|
Loading…
Reference in New Issue