mirror of
https://github.com/pocketpy/pocketpy
synced 2025-10-20 11:30:18 +00:00
some fix
This commit is contained in:
parent
15fd2ef8a0
commit
0bafc17994
@ -220,8 +220,10 @@ py_Ref py_getmodule(const char* name);
|
|||||||
bool py_import(const char* name, py_Ref out);
|
bool py_import(const char* name, py_Ref out);
|
||||||
|
|
||||||
/************* Errors *************/
|
/************* Errors *************/
|
||||||
py_Error* py_lasterror();
|
/// Print the last error to the console.
|
||||||
void py_Error__print(py_Error*);
|
void py_printexc();
|
||||||
|
/// Format the last error to a string.
|
||||||
|
void py_formatexc(char* out);
|
||||||
|
|
||||||
/************* Operators *************/
|
/************* Operators *************/
|
||||||
/// Equivalent to `bool(val)`.
|
/// Equivalent to `bool(val)`.
|
||||||
@ -238,7 +240,7 @@ int py_gt(const py_Ref, const py_Ref);
|
|||||||
|
|
||||||
bool py_hash(const py_Ref, int64_t* out);
|
bool py_hash(const py_Ref, int64_t* out);
|
||||||
|
|
||||||
/// Compare two objects without using magic methods.
|
/// Python equivalent to `lhs is rhs`.
|
||||||
bool py_isidentical(const py_Ref, const py_Ref);
|
bool py_isidentical(const py_Ref, const py_Ref);
|
||||||
|
|
||||||
/// A stack operation that calls a function.
|
/// A stack operation that calls a function.
|
||||||
@ -256,7 +258,7 @@ bool py_call(py_Ref f, int argc, py_Ref argv);
|
|||||||
/// The result will be set to `py_retval()`.
|
/// The result will be set to `py_retval()`.
|
||||||
/// The stack remains unchanged after the operation.
|
/// The stack remains unchanged after the operation.
|
||||||
bool py_callmethod(py_Ref self, py_Name, int argc, py_Ref argv);
|
bool py_callmethod(py_Ref self, py_Name, int argc, py_Ref argv);
|
||||||
/// Call a magic method.
|
/// Call a magic method using a continuous buffer.
|
||||||
/// The result will be set to `py_retval()`.
|
/// The result will be set to `py_retval()`.
|
||||||
/// The stack remains unchanged after the operation.
|
/// The stack remains unchanged after the operation.
|
||||||
bool py_callmagic(py_Name name, int argc, py_Ref argv);
|
bool py_callmagic(py_Name name, int argc, py_Ref argv);
|
||||||
@ -264,7 +266,7 @@ bool py_callmagic(py_Name name, int argc, py_Ref argv);
|
|||||||
#define py_repr(self) py_callmagic(__repr__, 1, self)
|
#define py_repr(self) py_callmagic(__repr__, 1, self)
|
||||||
#define py_str(self) py_callmagic(__str__, 1, self)
|
#define py_str(self) py_callmagic(__str__, 1, self)
|
||||||
|
|
||||||
/// The return value of the most recent vectorcall.
|
/// The return value of the most recent call.
|
||||||
py_Ref py_retval();
|
py_Ref py_retval();
|
||||||
|
|
||||||
#define py_isnull(self) ((self)->type == 0)
|
#define py_isnull(self) ((self)->type == 0)
|
||||||
|
@ -1,15 +0,0 @@
|
|||||||
#include "pocketpy/pocketpy.h"
|
|
||||||
|
|
||||||
#include "pocketpy/common/utils.h"
|
|
||||||
#include "pocketpy/objects/object.h"
|
|
||||||
#include "pocketpy/interpreter/vm.h"
|
|
||||||
|
|
||||||
|
|
||||||
py_Error* py_lasterror(){
|
|
||||||
return pk_current_vm->last_error;
|
|
||||||
}
|
|
||||||
|
|
||||||
void py_Error__print(py_Error* self){
|
|
||||||
abort();
|
|
||||||
}
|
|
||||||
|
|
@ -92,6 +92,6 @@ bool py_callmagic(py_Name name, int argc, py_Ref argv) {
|
|||||||
assert(py_ismagicname(name));
|
assert(py_ismagicname(name));
|
||||||
py_Ref tmp = py_tpfindmagic(argv->type, name);
|
py_Ref tmp = py_tpfindmagic(argv->type, name);
|
||||||
if(!tmp) return TypeError(name);
|
if(!tmp) return TypeError(name);
|
||||||
if(tmp->type == tp_nativefunc) { return tmp->_cfunc(argc, argv); }
|
if(tmp->type == tp_nativefunc) return tmp->_cfunc(argc, argv);
|
||||||
return py_call(tmp, argc, argv);
|
return py_call(tmp, argc, argv);
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user