mirror of
https://github.com/pocketpy/pocketpy
synced 2025-10-20 03:20:18 +00:00
Compare commits
3 Commits
6e9dd9516b
...
897bc0be81
Author | SHA1 | Date | |
---|---|---|---|
|
897bc0be81 | ||
|
fb93b2bc8b | ||
|
1ab175006d |
@ -114,6 +114,8 @@ void c11_debugger_exception_on_trace(py_Ref exc) {
|
|||||||
debugger.current_excname = name;
|
debugger.current_excname = name;
|
||||||
debugger.current_excmessage = message;
|
debugger.current_excmessage = message;
|
||||||
clear_structures();
|
clear_structures();
|
||||||
|
py_assign(py_list_getitem(python_vars, 0), exc);
|
||||||
|
py_clearexc(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* c11_debugger_excinfo(const char** message) {
|
const char* c11_debugger_excinfo(const char** message) {
|
||||||
@ -178,6 +180,8 @@ bool c11_debugger_path_equal(const char* path1, const char* path2) {
|
|||||||
C11_STOP_REASON c11_debugger_should_pause() {
|
C11_STOP_REASON c11_debugger_should_pause() {
|
||||||
if(debugger.current_event == TRACE_EVENT_POP && !debugger.isexceptionmode)
|
if(debugger.current_event == TRACE_EVENT_POP && !debugger.isexceptionmode)
|
||||||
return C11_DEBUGGER_NOSTOP;
|
return C11_DEBUGGER_NOSTOP;
|
||||||
|
if(py_checkexc() && debugger.isexceptionmode == false)
|
||||||
|
return C11_DEBUGGER_NOSTOP;
|
||||||
C11_STOP_REASON pause_resaon = C11_DEBUGGER_NOSTOP;
|
C11_STOP_REASON pause_resaon = C11_DEBUGGER_NOSTOP;
|
||||||
int is_out = debugger.curr_stack_depth <= debugger.pause_allowed_depth;
|
int is_out = debugger.curr_stack_depth <= debugger.pause_allowed_depth;
|
||||||
int is_new_line = debugger.current_line != debugger.step_line;
|
int is_new_line = debugger.current_line != debugger.step_line;
|
||||||
@ -282,8 +286,8 @@ inline static c11_debugger_scope_index append_new_scope(int frameid) {
|
|||||||
py_Frame* requested_frame = c11__getitem(py_Frame*, &debugger.py_frames, frameid);
|
py_Frame* requested_frame = c11__getitem(py_Frame*, &debugger.py_frames, frameid);
|
||||||
int base_index = py_list_len(python_vars);
|
int base_index = py_list_len(python_vars);
|
||||||
py_Ref new_locals = py_list_emplace(python_vars);
|
py_Ref new_locals = py_list_emplace(python_vars);
|
||||||
py_Ref new_globals = py_list_emplace(python_vars);
|
|
||||||
py_Frame_newlocals(requested_frame, new_locals);
|
py_Frame_newlocals(requested_frame, new_locals);
|
||||||
|
py_Ref new_globals = py_list_emplace(python_vars);
|
||||||
py_Frame_newglobals(requested_frame, new_globals);
|
py_Frame_newglobals(requested_frame, new_globals);
|
||||||
c11_debugger_scope_index result = {.locals_ref = base_index, .globals_ref = base_index + 1};
|
c11_debugger_scope_index result = {.locals_ref = base_index, .globals_ref = base_index + 1};
|
||||||
return result;
|
return result;
|
||||||
|
@ -260,7 +260,7 @@ bool pk_loadmethod(py_StackRef self, py_Name name) {
|
|||||||
self[0] = *py_getslot(cls_var, 0);
|
self[0] = *py_getslot(cls_var, 0);
|
||||||
self[1] = ti->self;
|
self[1] = ti->self;
|
||||||
break;
|
break;
|
||||||
default: c11__unreachable();
|
default: return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -158,12 +158,14 @@ bool py_matchexc(py_Type type) {
|
|||||||
void py_clearexc(py_StackRef p0) {
|
void py_clearexc(py_StackRef p0) {
|
||||||
VM* vm = pk_current_vm;
|
VM* vm = pk_current_vm;
|
||||||
py_newnil(&vm->unhandled_exc);
|
py_newnil(&vm->unhandled_exc);
|
||||||
if(p0) vm->stack.sp = p0;
|
if(p0) {
|
||||||
|
c11__rtassert(p0 >= vm->stack.begin && p0 <= vm->stack.sp);
|
||||||
|
vm->stack.sp = p0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void c11_sbuf__write_exc(c11_sbuf* self, py_Ref exc) {
|
static void c11_sbuf__write_exc(c11_sbuf* self, py_Ref exc) {
|
||||||
if(true) { c11_sbuf__write_cstr(self, "Traceback (most recent call last):\n"); }
|
c11_sbuf__write_cstr(self, "Traceback (most recent call last):\n");
|
||||||
|
|
||||||
BaseException* ud = py_touserdata(exc);
|
BaseException* ud = py_touserdata(exc);
|
||||||
|
|
||||||
for(int i = ud->stacktrace.length - 1; i >= 0; i--) {
|
for(int i = ud->stacktrace.length - 1; i >= 0; i--) {
|
||||||
|
@ -169,4 +169,14 @@ for x in xs:
|
|||||||
xs.append(x+1)
|
xs.append(x+1)
|
||||||
|
|
||||||
assert res == list(range(101))
|
assert res == list(range(101))
|
||||||
assert xs == res
|
assert xs == res
|
||||||
|
|
||||||
|
# call property
|
||||||
|
from vmath import vec2
|
||||||
|
|
||||||
|
a = vec2(1, 2)
|
||||||
|
try:
|
||||||
|
x = a.x()
|
||||||
|
exit(1)
|
||||||
|
except TypeError:
|
||||||
|
pass
|
Loading…
x
Reference in New Issue
Block a user