mirror of
https://github.com/pocketpy/pocketpy
synced 2025-12-13 13:40:16 +00:00
Compare commits
No commits in common. "b1ffa191d2ac1ebf9ca3b014da2d7ced4a4cff2d" and "1d319c4ab67063ca19d02c9012d16b7a2c4ba1d8" have entirely different histories.
b1ffa191d2
...
1d319c4ab6
@ -468,7 +468,7 @@ PK_EXPORT bool KeyError(py_Ref key) PY_RAISE;
|
|||||||
|
|
||||||
/// Python equivalent to `bool(val)`.
|
/// Python equivalent to `bool(val)`.
|
||||||
/// 1: true, 0: false, -1: error
|
/// 1: true, 0: false, -1: error
|
||||||
PK_EXPORT int py_bool(py_Ref val) PY_RAISE;
|
PK_EXPORT int py_bool(py_Ref val) PY_RAISE PY_RETURN;
|
||||||
|
|
||||||
/// Compare two objects.
|
/// Compare two objects.
|
||||||
/// 1: lhs == rhs, 0: lhs != rhs, -1: error
|
/// 1: lhs == rhs, 0: lhs != rhs, -1: error
|
||||||
@ -598,7 +598,7 @@ enum py_PredefinedTypes {
|
|||||||
tp_nativefunc,
|
tp_nativefunc,
|
||||||
tp_boundmethod,
|
tp_boundmethod,
|
||||||
tp_super, // 1 slot + py_Type
|
tp_super, // 1 slot + py_Type
|
||||||
tp_BaseException, // 2 slots (arg + inner_exc)
|
tp_BaseException, // 2 slots (arg + inner exc)
|
||||||
tp_Exception,
|
tp_Exception,
|
||||||
tp_bytes,
|
tp_bytes,
|
||||||
tp_namedict,
|
tp_namedict,
|
||||||
|
|||||||
@ -486,10 +486,6 @@ FrameResult VM__vectorcall(VM* self, uint16_t argc, uint16_t kwargc, bool opcall
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(p0->type == tp_nativefunc) {
|
if(p0->type == tp_nativefunc) {
|
||||||
if(kwargc) {
|
|
||||||
TypeError("nativefunc does not accept keyword arguments");
|
|
||||||
return RES_ERROR;
|
|
||||||
}
|
|
||||||
bool ok = py_callcfunc(p0->_cfunc, p1 - argv, argv);
|
bool ok = py_callcfunc(p0->_cfunc, p1 - argv, argv);
|
||||||
self->stack.sp = p0;
|
self->stack.sp = p0;
|
||||||
return ok ? RES_RETURN : RES_ERROR;
|
return ok ? RES_RETURN : RES_ERROR;
|
||||||
|
|||||||
@ -99,18 +99,6 @@ static bool _py_BaseException__str__(int argc, py_Ref argv) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool BaseException_args(int argc, py_Ref argv){
|
|
||||||
PY_CHECK_ARGC(1);
|
|
||||||
py_Ref arg = py_getslot(argv, 0);
|
|
||||||
if(!py_isnil(arg)) {
|
|
||||||
py_newtuple(py_retval(), 1);
|
|
||||||
py_setslot(py_retval(), 0, arg);
|
|
||||||
}else{
|
|
||||||
py_newtuple(py_retval(), 0);
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
py_Type pk_BaseException__register() {
|
py_Type pk_BaseException__register() {
|
||||||
py_Type type = pk_newtype("BaseException", tp_object, NULL, BaseException__dtor, false, false);
|
py_Type type = pk_newtype("BaseException", tp_object, NULL, BaseException__dtor, false, false);
|
||||||
|
|
||||||
@ -118,7 +106,6 @@ py_Type pk_BaseException__register() {
|
|||||||
py_bindmagic(type, __init__, _py_BaseException__init__);
|
py_bindmagic(type, __init__, _py_BaseException__init__);
|
||||||
py_bindmagic(type, __repr__, _py_BaseException__repr__);
|
py_bindmagic(type, __repr__, _py_BaseException__repr__);
|
||||||
py_bindmagic(type, __str__, _py_BaseException__str__);
|
py_bindmagic(type, __str__, _py_BaseException__str__);
|
||||||
py_bindproperty(type, "args", BaseException_args, NULL);
|
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -272,11 +272,7 @@ static bool str_join(int argc, py_Ref argv) {
|
|||||||
bool first = true;
|
bool first = true;
|
||||||
while(true) {
|
while(true) {
|
||||||
int res = py_next(py_peek(-1));
|
int res = py_next(py_peek(-1));
|
||||||
if(res == -1) {
|
if(res == -1) return false;
|
||||||
c11_sbuf__dtor(&buf);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(res == 0) break;
|
if(res == 0) break;
|
||||||
|
|
||||||
if(!first) c11_sbuf__write_sv(&buf, self);
|
if(!first) c11_sbuf__write_sv(&buf, self);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user