mirror of
https://github.com/pocketpy/pocketpy
synced 2025-10-22 12:30:19 +00:00
some fix
This commit is contained in:
parent
75343ccb23
commit
8a5deb6ebb
@ -89,9 +89,10 @@ struct Exception {
|
||||
};
|
||||
|
||||
struct TopLevelException: std::exception{
|
||||
VM* vm;
|
||||
Exception* ptr;
|
||||
TopLevelException(Exception* ptr): ptr(ptr) {}
|
||||
|
||||
TopLevelException(VM* vm, Exception* ptr): vm(vm), ptr(ptr) {}
|
||||
|
||||
Str summary() const { return ptr->summary(); }
|
||||
|
||||
const char* what() const noexcept override {
|
||||
|
@ -1057,7 +1057,7 @@ __NEXT_STEP:
|
||||
__pop_frame();
|
||||
if(callstack.empty()){
|
||||
// propagate to the top level
|
||||
throw TopLevelException(&_e);
|
||||
throw TopLevelException(this, &_e);
|
||||
}
|
||||
frame = &callstack.top();
|
||||
PUSH(__last_exception);
|
||||
|
@ -1379,7 +1379,7 @@ __EAT_DOTS_END:
|
||||
vm->__last_exception = vm->call(vm->builtins->attr(type), VAR(msg)).get();
|
||||
Exception& e = vm->__last_exception->as<Exception>();
|
||||
e.st_push(src, lineno, cursor, "");
|
||||
throw TopLevelException(&e);
|
||||
throw TopLevelException(vm, &e);
|
||||
}
|
||||
|
||||
std::string_view TokenDeserializer::read_string(char c){
|
||||
|
@ -1442,7 +1442,7 @@ void VM::_error(PyVar e_obj){
|
||||
if(callstack.empty()){
|
||||
e.is_re = false;
|
||||
__last_exception = e_obj.get();
|
||||
throw TopLevelException(&e);
|
||||
throw TopLevelException(this, &e);
|
||||
}
|
||||
PUSH(e_obj);
|
||||
__raise_exc();
|
||||
|
Loading…
x
Reference in New Issue
Block a user