def native(type_, value):
if isinstance(value, type_):
return value
if sys.version_info < (3,) and type_ == int and isinstance(value, int_types):
return value
if isinstance(value, ctypes.Array) and value._type_ == ctypes.c_byte:
return ctypes.string_at(ctypes.addressof(value), value._length_)
return type_(value.value)
评论列表
文章目录