Commit 47bf6032 authored by Michael Spanier's avatar Michael Spanier

cython: allow strings to be set as options

parent 44927dd3
Pipeline #20664149 passed with stages
in 4 minutes
......@@ -459,15 +459,15 @@ cdef class Block:
def set_option(self, key, value):
cdef KErrorCode err
cdef str strval
cdef char* strval
cdef int intval
cdef float floatval
t = type(value)
if t is str:
raise Exception ("string options currently unsupported")
#err = kblock_set_option (self.kobj, key, <char*>value.encode())
strval = value
err = kblock_set_option (self.kobj, key, strval)
elif t is int:
intval = value
err = kblock_set_option (self.kobj, key, intval)
......@@ -475,7 +475,8 @@ cdef class Block:
floatval = value
err = kblock_set_option (self.kobj, key, floatval)
raise Exception ("value must be str, int or float")
raise Exception ("value must be str, int, or float")
if err != SUCCESS:
raise Exception (kerror(err))
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment