mirror of
https://gitee.com/Lyon1998/pikapython.git
synced 2025-01-15 17:02:53 +08:00
support len() for bytes
This commit is contained in:
parent
e8ffa73d2a
commit
f0b5be9c92
@ -269,6 +269,9 @@ int PikaStdLib_SysObj_len(PikaObj* self, Arg* arg) {
|
|||||||
if (ARG_TYPE_STRING == arg_getType(arg)) {
|
if (ARG_TYPE_STRING == arg_getType(arg)) {
|
||||||
return strGetSize(arg_getStr(arg));
|
return strGetSize(arg_getStr(arg));
|
||||||
}
|
}
|
||||||
|
if (ARG_TYPE_BYTES == arg_getType(arg)) {
|
||||||
|
return arg_getBytesSize(arg);
|
||||||
|
}
|
||||||
obj_setErrorCode(self, 1);
|
obj_setErrorCode(self, 1);
|
||||||
__platform_printf("[Error] len: arg type not support\r\n");
|
__platform_printf("[Error] len: arg type not support\r\n");
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -269,6 +269,9 @@ int PikaStdLib_SysObj_len(PikaObj* self, Arg* arg) {
|
|||||||
if (ARG_TYPE_STRING == arg_getType(arg)) {
|
if (ARG_TYPE_STRING == arg_getType(arg)) {
|
||||||
return strGetSize(arg_getStr(arg));
|
return strGetSize(arg_getStr(arg));
|
||||||
}
|
}
|
||||||
|
if (ARG_TYPE_BYTES == arg_getType(arg)) {
|
||||||
|
return arg_getBytesSize(arg);
|
||||||
|
}
|
||||||
obj_setErrorCode(self, 1);
|
obj_setErrorCode(self, 1);
|
||||||
__platform_printf("[Error] len: arg type not support\r\n");
|
__platform_printf("[Error] len: arg type not support\r\n");
|
||||||
return -1;
|
return -1;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user