blueloveTH 1 vuosi sitten
vanhempi
commit
75343ccb23
3 muutettua tiedostoa jossa 4 lisäystä ja 5 poistoa
  1. 1 2
      include/pocketpy/error.h
  2. 2 2
      src/pocketpy.cpp
  3. 1 1
      src/pocketpy_c.cpp

+ 1 - 2
include/pocketpy/error.h

@@ -91,8 +91,7 @@ struct Exception {
 struct TopLevelException: std::exception{
     Exception* ptr;
     TopLevelException(Exception* ptr): ptr(ptr) {}
-
-    PyObject* self() const { return ptr->self(); }
+    
     Str summary() const { return ptr->summary(); }
 
     const char* what() const noexcept override {

+ 2 - 2
src/pocketpy.cpp

@@ -1680,7 +1680,7 @@ CodeObject_ VM::compile(std::string_view source, const Str& filename, CompileMod
     try{
         return compiler.compile();
     }catch(TopLevelException e){
-        _error(e.self());
+        _error(e.ptr->self());
         return nullptr;
     }
 }
@@ -1690,7 +1690,7 @@ Str VM::precompile(std::string_view source, const Str& filename, CompileMode mod
     try{
         return compiler.precompile();
     }catch(TopLevelException e){
-        _error(e.self());
+        _error(e.ptr->self());
         return nullptr;
     }
 }

+ 1 - 1
src/pocketpy_c.cpp

@@ -45,7 +45,7 @@ static PyVar stack_item(VM* vm, int index){
 #define PK_PROTECTED(__B) \
     try{ __B }  \
     catch(TopLevelException e) { \
-        vm->__c.error = e.self(); \
+        vm->__c.error = e.ptr->self(); \
         return false; \
     } catch(const std::exception& re){ \
         PyObject* e_t = vm->_t(vm->tp_exception); \