mirror of
https://github.com/pocketpy/pocketpy
synced 2025-10-20 03:20:18 +00:00
...
This commit is contained in:
parent
a5725824b4
commit
26c553eb9a
@ -281,6 +281,9 @@ void py_setslot(py_Ref self, int i, py_Ref val);
|
||||
/// Get the current `function` object from the stack.
|
||||
/// Return `NULL` if not available.
|
||||
py_StackRef py_inspect_currentfunction();
|
||||
/// Get the current `module` object where the code is executed.
|
||||
/// Return `NULL` if not available.
|
||||
py_GlobalRef py_inspect_currentmodule();
|
||||
|
||||
/************* Bindings *************/
|
||||
|
||||
|
@ -64,6 +64,12 @@ py_StackRef py_inspect_currentfunction(){
|
||||
return frame->p0;
|
||||
}
|
||||
|
||||
py_GlobalRef py_inspect_currentmodule(){
|
||||
Frame* frame = pk_current_vm->top_frame;
|
||||
if(!frame) return NULL;
|
||||
return frame->module;
|
||||
}
|
||||
|
||||
void py_assign(py_Ref dst, py_Ref src) { *dst = *src; }
|
||||
|
||||
/* Stack References */
|
||||
|
Loading…
x
Reference in New Issue
Block a user