2024-04-25 23:59:25 发布
网友
我正在尝试从python调用thrift IDL。一个变量的thrift数据类型是I32。 我需要发送介于0和2^32-1之间的值。对于介于2^31和2^32-1之间的值,python将其转换为long。所以,我得到了一个错误,对这些值说'integer超出'I'format code'的范围。我试着转换成ctypes.c\u uint32。它不起作用。 我怎样才能解决这个问题?在
这不是Python的问题,这是您的一个误解,什么数字适合i32字段。在
i32
来自Thrift: The Missing Guide:
Note that Thrift does not support unsigned integers because they have no direct translation to native (primitive) types in many of Thrift’s target languages.
从Thrift Types documentation:
Note the absence of unsigned integer types. This is due to the fact that there are no native unsigned integer types in many programming languages.
强调我的。在
如果要在cd2上使用一个^-31}的值,就不要使用^-31}来代替^-1}的值。在
这不是Python的问题,这是您的一个误解,什么数字适合
i32
字段。在来自Thrift: The Missing Guide:
从Thrift Types documentation:
强调我的。在
如果要在cd2上使用一个^-31}的值,就不要使用^-31}来代替^-1}的值。在
相关问题 更多 >
编程相关推荐