diff options
Diffstat (limited to 'sources')
-rw-r--r-- | sources/shiboken6/libshiboken/sbkenum.cpp | 9 | ||||
-rw-r--r-- | sources/shiboken6/libshiboken/signature/signature_extend.cpp | 9 |
2 files changed, 12 insertions, 6 deletions
diff --git a/sources/shiboken6/libshiboken/sbkenum.cpp b/sources/shiboken6/libshiboken/sbkenum.cpp index dbf338331..dbea84fb8 100644 --- a/sources/shiboken6/libshiboken/sbkenum.cpp +++ b/sources/shiboken6/libshiboken/sbkenum.cpp @@ -264,12 +264,19 @@ static PyGetSetDef SbkEnumGetSetList[] = { static void SbkEnumTypeDealloc(PyObject *pyObj); static PyObject *SbkEnumTypeTpNew(PyTypeObject *metatype, PyObject *args, PyObject *kwds); +static PyGetSetDef SbkEnumType_getsetlist[] = { + {const_cast<char *>("__signature__"), reinterpret_cast<getter>(Sbk_TypeGet___signature__), + nullptr, nullptr, nullptr}, + {nullptr, nullptr, nullptr, nullptr, nullptr} // Sentinel +}; + static PyType_Slot SbkEnumType_Type_slots[] = { {Py_tp_dealloc, reinterpret_cast<void *>(SbkEnumTypeDealloc)}, {Py_tp_base, reinterpret_cast<void *>(&PyType_Type)}, {Py_tp_alloc, reinterpret_cast<void *>(PyType_GenericAlloc)}, {Py_tp_new, reinterpret_cast<void *>(SbkEnumTypeTpNew)}, {Py_tp_free, reinterpret_cast<void *>(PyObject_GC_Del)}, + {Py_tp_getset, reinterpret_cast<void *>(SbkEnumType_getsetlist)}, {0, nullptr} }; static PyType_Spec SbkEnumType_Type_spec = { @@ -614,7 +621,7 @@ static PyType_Spec SbkNewEnum_spec = { static PyTypeObject *SbkEnum_TypeF() { - static auto type = SbkType_FromSpec(&SbkNewEnum_spec); + static auto type = SbkType_FromSpecWithMeta(&SbkNewEnum_spec, SbkEnumType_TypeF()); return type; } diff --git a/sources/shiboken6/libshiboken/signature/signature_extend.cpp b/sources/shiboken6/libshiboken/signature/signature_extend.cpp index 528c7c87a..4b67d778f 100644 --- a/sources/shiboken6/libshiboken/signature/signature_extend.cpp +++ b/sources/shiboken6/libshiboken/signature/signature_extend.cpp @@ -48,12 +48,14 @@ // PyMethodDescr_Type // PyCFunction_Type // PyStaticMethod_Type -// PyType_Type +// (*) PyType_Type // PyWrapperDescr_Type // -// Their `tp_getset` fields are modified so support the `__signature__` +// Their `tp_getset` fields are modified to support the `__signature__` // attribute and additions to the `__doc__` attribute. // +// PYSIDE-535: PyType_Type patching is removed, +// Shiboken.ObjectType and Shiboken.EnumMeta have new getsets, instead. #include "autodecref.h" #include "sbkstring.h" @@ -282,8 +284,6 @@ int PySide_PatchTypes(void) auto cf_doc = &old_cf_doc_descr; auto sm_gs = new_PyStaticMethod_getsets; auto sm_doc = &old_sm_doc_descr; - auto tp_gs = new_PyType_getsets; - auto tp_doc = &old_tp_doc_descr; auto wd_gs = new_PyWrapperDescr_getsets; auto wd_doc = &old_wd_doc_descr; @@ -292,7 +292,6 @@ int PySide_PatchTypes(void) || add_more_getsets(PepMethodDescr_TypePtr, md_gs, md_doc) < 0 || add_more_getsets(&PyCFunction_Type, cf_gs, cf_doc) < 0 || add_more_getsets(PepStaticMethod_TypePtr, sm_gs, sm_doc) < 0 - || add_more_getsets(&PyType_Type, tp_gs, tp_doc) < 0 || add_more_getsets(Py_TYPE(wrap_descr), wd_gs, wd_doc) < 0 ) return -1; |