Fix error condition `ret < 0` -> `ret < len(insnlist)` for Device.do_insnlist.
authorW. Trevor King <wking@drexel.edu>
Mon, 19 Mar 2012 16:10:18 +0000 (12:10 -0400)
committerW. Trevor King <wking@drexel.edu>
Mon, 19 Mar 2012 16:10:18 +0000 (12:10 -0400)
The previous implemenation would apparently succeed if there was an
error executing an instruction.  It would only raise an exception if a
failure occured before the first instruction could be executed.

pycomedi/device.pyx

index b5ef68391cdcacb48793b3d25f5da29069046f16..bdff315459fcb8589f9aff80d50479132ad11682 100644 (file)
@@ -243,7 +243,7 @@ cdef class Device (object):
             ret = _comedilib_h.comedi_do_insnlist(self.device, &il)
         finally:
             _stdlib.free(il.insns)
-        if ret < 0:
+        if ret < len(insnlist):
             _error.raise_error(function_name='comedi_do_insnlist', ret=ret)
         return ret