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