mirror of
https://github.com/pocketpy/pocketpy
synced 2025-10-20 11:30:18 +00:00
some fix
This commit is contained in:
parent
7692899366
commit
a9d6242a43
@ -105,6 +105,7 @@ bool py_tobool(const py_Ref);
|
||||
py_Type py_totype(const py_Ref);
|
||||
const char* py_tostr(const py_Ref);
|
||||
const char* py_tostrn(const py_Ref, int* size);
|
||||
const unsigned char* py_tobytes(const py_Ref, int* size);
|
||||
|
||||
void* py_touserdata(const py_Ref);
|
||||
|
||||
|
@ -51,6 +51,13 @@ const char* py_tostrn(const py_Ref self, int* size){
|
||||
return py_Str__data(ud);
|
||||
}
|
||||
|
||||
const unsigned char* py_tobytes(const py_Ref self, int* size){
|
||||
assert(self->type == tp_bytes);
|
||||
int* ud = PyObject__value(self->_obj);
|
||||
*size = *ud;
|
||||
return (unsigned char*)(ud + 1);
|
||||
}
|
||||
|
||||
void* py_touserdata(const py_Ref self){
|
||||
assert(self && self->is_ptr);
|
||||
return PyObject__value(self->_obj);
|
||||
|
Loading…
x
Reference in New Issue
Block a user