mirror of
https://github.com/pocketpy/pocketpy
synced 2025-12-11 20:50:17 +00:00
Compare commits
No commits in common. "d14e861b2e008c2a79abba163085b332c8b3dc94" and "b1ffa191d2ac1ebf9ca3b014da2d7ced4a4cff2d" have entirely different histories.
d14e861b2e
...
b1ffa191d2
@ -71,7 +71,6 @@ bool pk__normalize_index(int* index, int length);
|
|||||||
void pk__mark_value(py_TValue*);
|
void pk__mark_value(py_TValue*);
|
||||||
void pk__mark_namedict(NameDict*);
|
void pk__mark_namedict(NameDict*);
|
||||||
void pk__tp_set_marker(py_Type type, void (*gc_mark)(void*));
|
void pk__tp_set_marker(py_Type type, void (*gc_mark)(void*));
|
||||||
bool pk__object_new(int argc, py_Ref argv);
|
|
||||||
|
|
||||||
bool pk_wrapper__self(int argc, py_Ref argv);
|
bool pk_wrapper__self(int argc, py_Ref argv);
|
||||||
bool pk_wrapper__NotImplementedError(int argc, py_Ref argv);
|
bool pk_wrapper__NotImplementedError(int argc, py_Ref argv);
|
||||||
|
|||||||
@ -164,9 +164,9 @@ PK_EXPORT void py_newboundmethod(py_Ref out, py_Ref self, py_Ref func);
|
|||||||
PK_EXPORT py_Name py_name(const char*);
|
PK_EXPORT py_Name py_name(const char*);
|
||||||
/// Convert a name to a null-terminated string.
|
/// Convert a name to a null-terminated string.
|
||||||
PK_EXPORT const char* py_name2str(py_Name);
|
PK_EXPORT const char* py_name2str(py_Name);
|
||||||
/// Convert a `c11_sv` to a name.
|
|
||||||
PK_EXPORT py_Name py_namev(c11_sv);
|
|
||||||
/// Convert a name to a `c11_sv`.
|
/// Convert a name to a `c11_sv`.
|
||||||
|
PK_EXPORT py_Name py_namev(c11_sv name);
|
||||||
|
/// Convert a `c11_sv` to a name.
|
||||||
PK_EXPORT c11_sv py_name2sv(py_Name);
|
PK_EXPORT c11_sv py_name2sv(py_Name);
|
||||||
|
|
||||||
#define py_ismagicname(name) (name <= __missing__)
|
#define py_ismagicname(name) (name <= __missing__)
|
||||||
|
|||||||
@ -486,7 +486,7 @@ FrameResult VM__vectorcall(VM* self, uint16_t argc, uint16_t kwargc, bool opcall
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(p0->type == tp_nativefunc) {
|
if(p0->type == tp_nativefunc) {
|
||||||
if(kwargc && p0->_cfunc != pk__object_new) {
|
if(kwargc) {
|
||||||
TypeError("nativefunc does not accept keyword arguments");
|
TypeError("nativefunc does not accept keyword arguments");
|
||||||
return RES_ERROR;
|
return RES_ERROR;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
#include "pocketpy/common/sstream.h"
|
#include "pocketpy/common/sstream.h"
|
||||||
#include "pocketpy/pocketpy.h"
|
#include "pocketpy/pocketpy.h"
|
||||||
|
|
||||||
bool pk__object_new(int argc, py_Ref argv) {
|
static bool object__new__(int argc, py_Ref argv) {
|
||||||
if(argc == 0) return TypeError("object.__new__(): not enough arguments");
|
if(argc == 0) return TypeError("object.__new__(): not enough arguments");
|
||||||
py_Type cls = py_totype(py_arg(0));
|
py_Type cls = py_totype(py_arg(0));
|
||||||
py_TypeInfo* ti = c11__at(py_TypeInfo, &pk_current_vm->types, cls);
|
py_TypeInfo* ti = c11__at(py_TypeInfo, &pk_current_vm->types, cls);
|
||||||
@ -110,7 +110,7 @@ static bool type__module__(int argc, py_Ref argv) {
|
|||||||
|
|
||||||
void pk_object__register() {
|
void pk_object__register() {
|
||||||
// TODO: use staticmethod
|
// TODO: use staticmethod
|
||||||
py_bindmagic(tp_object, __new__, pk__object_new);
|
py_bindmagic(tp_object, __new__, object__new__);
|
||||||
|
|
||||||
py_bindmagic(tp_object, __hash__, object__hash__);
|
py_bindmagic(tp_object, __hash__, object__hash__);
|
||||||
py_bindmagic(tp_object, __eq__, object__eq__);
|
py_bindmagic(tp_object, __eq__, object__eq__);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user