mirror of
https://github.com/pocketpy/pocketpy
synced 2025-10-23 21:10:19 +00:00
some fix
This commit is contained in:
parent
589a1e7ae4
commit
75343ccb23
@ -92,7 +92,6 @@ struct TopLevelException: std::exception{
|
|||||||
Exception* ptr;
|
Exception* ptr;
|
||||||
TopLevelException(Exception* ptr): ptr(ptr) {}
|
TopLevelException(Exception* ptr): ptr(ptr) {}
|
||||||
|
|
||||||
PyObject* self() const { return ptr->self(); }
|
|
||||||
Str summary() const { return ptr->summary(); }
|
Str summary() const { return ptr->summary(); }
|
||||||
|
|
||||||
const char* what() const noexcept override {
|
const char* what() const noexcept override {
|
||||||
|
|||||||
@ -1680,7 +1680,7 @@ CodeObject_ VM::compile(std::string_view source, const Str& filename, CompileMod
|
|||||||
try{
|
try{
|
||||||
return compiler.compile();
|
return compiler.compile();
|
||||||
}catch(TopLevelException e){
|
}catch(TopLevelException e){
|
||||||
_error(e.self());
|
_error(e.ptr->self());
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1690,7 +1690,7 @@ Str VM::precompile(std::string_view source, const Str& filename, CompileMode mod
|
|||||||
try{
|
try{
|
||||||
return compiler.precompile();
|
return compiler.precompile();
|
||||||
}catch(TopLevelException e){
|
}catch(TopLevelException e){
|
||||||
_error(e.self());
|
_error(e.ptr->self());
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -45,7 +45,7 @@ static PyVar stack_item(VM* vm, int index){
|
|||||||
#define PK_PROTECTED(__B) \
|
#define PK_PROTECTED(__B) \
|
||||||
try{ __B } \
|
try{ __B } \
|
||||||
catch(TopLevelException e) { \
|
catch(TopLevelException e) { \
|
||||||
vm->__c.error = e.self(); \
|
vm->__c.error = e.ptr->self(); \
|
||||||
return false; \
|
return false; \
|
||||||
} catch(const std::exception& re){ \
|
} catch(const std::exception& re){ \
|
||||||
PyObject* e_t = vm->_t(vm->tp_exception); \
|
PyObject* e_t = vm->_t(vm->tp_exception); \
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user