mirror of
https://github.com/pocketpy/pocketpy
synced 2025-10-20 11:30:18 +00:00
...
This commit is contained in:
parent
b6eeaa8cbc
commit
3ea3cf7366
@ -887,7 +887,7 @@ pk_FrameResult pk_VM__run_top_frame(pk_VM* self) {
|
|||||||
goto __ERROR;
|
goto __ERROR;
|
||||||
}
|
}
|
||||||
case OP_RE_RAISE: {
|
case OP_RE_RAISE: {
|
||||||
py_raise(&self->curr_exception);
|
assert(self->curr_exception.type);
|
||||||
goto __ERROR_RE_RAISE;
|
goto __ERROR_RE_RAISE;
|
||||||
}
|
}
|
||||||
case OP_PUSH_EXCEPTION: {
|
case OP_PUSH_EXCEPTION: {
|
||||||
|
@ -199,6 +199,11 @@ static bool _py_builtins__print(int argc, py_Ref argv) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool _py_NoneType__repr__(int argc, py_Ref argv) {
|
||||||
|
py_newstr(py_retval(), "None");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
py_TValue pk_builtins__register() {
|
py_TValue pk_builtins__register() {
|
||||||
py_Ref builtins = py_newmodule("builtins", NULL);
|
py_Ref builtins = py_newmodule("builtins", NULL);
|
||||||
py_bindnativefunc(builtins, "repr", _py_builtins__repr);
|
py_bindnativefunc(builtins, "repr", _py_builtins__repr);
|
||||||
@ -214,6 +219,9 @@ py_TValue pk_builtins__register() {
|
|||||||
|
|
||||||
py_bind(builtins, "print(*args, sep=' ', end='\\n')", _py_builtins__print);
|
py_bind(builtins, "print(*args, sep=' ', end='\\n')", _py_builtins__print);
|
||||||
py_bind(builtins, "sorted(iterable, key=None, reverse=False)", _py_builtins__sorted);
|
py_bind(builtins, "sorted(iterable, key=None, reverse=False)", _py_builtins__sorted);
|
||||||
|
|
||||||
|
// None __repr__
|
||||||
|
py_bindmagic(tp_NoneType, __repr__, _py_NoneType__repr__);
|
||||||
return *builtins;
|
return *builtins;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,3 +1,12 @@
|
|||||||
|
def f():
|
||||||
|
raise IndexError
|
||||||
|
|
||||||
|
try:
|
||||||
|
f()
|
||||||
|
exit(1)
|
||||||
|
except IndexError:
|
||||||
|
pass
|
||||||
|
|
||||||
try:
|
try:
|
||||||
assert False
|
assert False
|
||||||
exit(1)
|
exit(1)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user