diff --git a/CinderX/_cinderx.cpp b/CinderX/_cinderx.cpp index ef0114b555e..aa0a49de9aa 100644 --- a/CinderX/_cinderx.cpp +++ b/CinderX/_cinderx.cpp @@ -51,6 +51,15 @@ static PyGetSetDef Ci_method_getset[] = { {}, }; +static PyGetSetDef Ci_meth_getset[] = { + {.name = "__doc__", .get = (getter)Cix_meth_get__doc__, .set = nullptr, .doc = nullptr, .closure = nullptr}, + {.name = "__name__", .get = (getter)Cix_meth_get__name__, .set = nullptr, .doc = nullptr, .closure = nullptr}, + {.name = "__qualname__", .get = (getter)Cix_meth_get__qualname__, .set = nullptr, .doc = nullptr, .closure = nullptr}, + {.name = "__text_signature__", .get = (getter)Cix_meth_get__text_signature__, .set = nullptr, .doc = nullptr, .closure = nullptr}, + {.name = "__typed_signature__", .get = (getter)Ci_meth_get__typed_signature__, .set = nullptr, .doc = nullptr, .closure = nullptr}, + {}, +}; + static int init_already_existing_types() { PyUnstable_GC_VisitObjects([](PyObject* obj, void*) { if (PyType_Check(obj) && PyType_HasFeature((PyTypeObject*)obj, Py_TPFLAGS_READY)) { @@ -65,6 +74,9 @@ static int init_already_existing_types() { if (override_tp_getset(&PyClassMethodDescr_Type, Ci_method_getset) < 0) { return -1; } + if (override_tp_getset(&PyCFunction_Type, Ci_meth_getset) < 0) { + return -1; + } return 0; } diff --git a/Objects/methodobject.c b/Objects/methodobject.c index 677fecb58cd..0bbe6cd25f6 100644 --- a/Objects/methodobject.c +++ b/Objects/methodobject.c @@ -12,7 +12,6 @@ #ifdef ENABLE_CINDERX #include "StaticPython/classloader.h" -#include "StaticPython/methodobject_vectorcall.h" #endif /* undefine macro trampoline to PyCFunction_NewEx */ @@ -435,9 +434,6 @@ static PyGetSetDef meth_getsets [] = { {"__qualname__", (getter)meth_get__qualname__, NULL, NULL}, {"__self__", (getter)meth_get__self__, NULL, NULL}, {"__text_signature__", (getter)meth_get__text_signature__, NULL, NULL}, -#ifdef ENABLE_CINDERX - {"__typed_signature__", (getter)Ci_meth_get__typed_signature__, NULL, NULL}, -#endif {0} };