mirror of
https://github.com/pocketpy/pocketpy
synced 2025-10-20 11:30:18 +00:00
complex error case is working
This commit is contained in:
parent
897362075b
commit
a00cba8de1
@ -315,23 +315,10 @@ int main(int argc, char** argv) {
|
|||||||
|
|
||||||
|
|
||||||
//more complicated error handling
|
//more complicated error handling
|
||||||
//
|
check(pkpy_vm_run(vm, "def error_from_python() : raise NotImplementedError()"));
|
||||||
//at the moment this is disabled, as this use case is not supported
|
check(pkpy_push_function(vm, test_nested_error, 0));
|
||||||
//it will cause the program to abort
|
check(pkpy_set_global(vm, "test_nested_error"));
|
||||||
//
|
error(pkpy_vm_run(vm, "test_nested_error()"));
|
||||||
//a python exception thrown from python can not pass through a c binding
|
|
||||||
//
|
|
||||||
//this means for now the api can only be used to make shallow bindings, or
|
|
||||||
//else care must be taken to not let an exception go through a c binding by
|
|
||||||
//catching it in python first
|
|
||||||
//
|
|
||||||
//at such a time this interferes with a real world use case of the bindings
|
|
||||||
//we can revisit it
|
|
||||||
//
|
|
||||||
//check(pkpy_vm_run(vm, "def error_from_python() : raise NotImplementedError()"));
|
|
||||||
//check(pkpy_push_function(vm, test_nested_error, 0));
|
|
||||||
//check(pkpy_set_global(vm, "test_nested_error"));
|
|
||||||
//error(pkpy_vm_run(vm, "test_nested_error()"));
|
|
||||||
|
|
||||||
check(pkpy_vm_run(vm, "import math"));
|
check(pkpy_vm_run(vm, "import math"));
|
||||||
check(pkpy_get_global(vm, "math"));
|
check(pkpy_get_global(vm, "math"));
|
||||||
|
@ -63,6 +63,13 @@ NameError: testing error throwing from python
|
|||||||
successfully errored with this message:
|
successfully errored with this message:
|
||||||
Traceback (most recent call last):
|
Traceback (most recent call last):
|
||||||
_: test direct error mechanism
|
_: test direct error mechanism
|
||||||
|
successfully errored with this message:
|
||||||
|
Traceback (most recent call last):
|
||||||
|
File "<c-bound>", line 1
|
||||||
|
test_nested_error()
|
||||||
|
File "<c-bound>", line 1
|
||||||
|
def error_from_python() : raise NotImplementedError()
|
||||||
|
NotImplementedError
|
||||||
pi: 3.14
|
pi: 3.14
|
||||||
pi: 3.14
|
pi: 3.14
|
||||||
2
|
2
|
||||||
|
Loading…
x
Reference in New Issue
Block a user