mirror of
https://github.com/pocketpy/pocketpy
synced 2025-10-20 19:40:18 +00:00
...
This commit is contained in:
parent
a8dfbc9147
commit
2165e29c4f
@ -908,7 +908,7 @@ pk_FrameResult pk_VM__run_top_frame(pk_VM* self) {
|
|||||||
c11__unreachedable();
|
c11__unreachedable();
|
||||||
|
|
||||||
__ERROR:
|
__ERROR:
|
||||||
pk_print_stack(self, frame, (Bytecode){OP_NO_OP, 0});
|
pk_print_stack(self, frame, (Bytecode){});
|
||||||
py_BaseException__set_lineno(&self->curr_exception, Frame__lineno(frame), frame->co);
|
py_BaseException__set_lineno(&self->curr_exception, Frame__lineno(frame), frame->co);
|
||||||
__ERROR_RE_RAISE:
|
__ERROR_RE_RAISE:
|
||||||
|
|
||||||
|
@ -294,6 +294,9 @@ py_Type pk_newtype(const char* name,
|
|||||||
py_Type index = types->count;
|
py_Type index = types->count;
|
||||||
pk_TypeInfo* ti = c11_vector__emplace(types);
|
pk_TypeInfo* ti = c11_vector__emplace(types);
|
||||||
pk_TypeInfo__ctor(ti, py_name(name), index, base, module ? *module : *py_NIL);
|
pk_TypeInfo__ctor(ti, py_name(name), index, base, module ? *module : *py_NIL);
|
||||||
|
if(!dtor && base){
|
||||||
|
dtor = c11__at(pk_TypeInfo, types, base)->dtor;
|
||||||
|
}
|
||||||
ti->dtor = dtor;
|
ti->dtor = dtor;
|
||||||
ti->is_python = is_python;
|
ti->is_python = is_python;
|
||||||
ti->is_sealed = is_sealed;
|
ti->is_sealed = is_sealed;
|
||||||
|
@ -62,7 +62,8 @@ bool py_raise(py_Ref exc) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool KeyError(py_Ref key){
|
bool KeyError(py_Ref key){
|
||||||
if(!py_repr(key)) return false;
|
py_Ref cls = py_getdict(&pk_current_vm->builtins, py_name("KeyError"));
|
||||||
c11_sv message = py_tosv(py_retval());
|
bool ok = py_call(cls, 1, key);
|
||||||
return py_exception("KeyError", "%q", message);
|
if(!ok) return false;
|
||||||
|
return py_raise(py_retval());
|
||||||
}
|
}
|
@ -135,13 +135,13 @@ except Exception:
|
|||||||
exit(1)
|
exit(1)
|
||||||
assert ok
|
assert ok
|
||||||
|
|
||||||
ok = False
|
# ok = False
|
||||||
try:
|
# try:
|
||||||
eval('1+')
|
# eval('1+')
|
||||||
except SyntaxError as e:
|
# except SyntaxError as e:
|
||||||
assert type(e) is SyntaxError
|
# assert type(e) is SyntaxError
|
||||||
ok = True
|
# ok = True
|
||||||
assert ok
|
# assert ok
|
||||||
|
|
||||||
"""
|
"""
|
||||||
# finally, only
|
# finally, only
|
||||||
|
Loading…
x
Reference in New Issue
Block a user