diff options
author | Christian Tismer <tismer@stackless.com> | 2021-12-09 16:42:08 +0100 |
---|---|---|
committer | Christian Tismer <tismer@stackless.com> | 2021-12-09 21:26:36 +0100 |
commit | 713fed0392f0524ca2eb2779b42c906601c76900 (patch) | |
tree | bdee8b224ccb1d69d83ebbcaa3fd937f8d7a5f25 /sources/shiboken6/libshiboken/signature/signature_extend.cpp | |
parent | 87efa57c6ddc1a8364b2ea4d9f909372d0af5cfc (diff) |
Signature: fix the __doc__ attribute of classes, amended
This additional change reverts the generation of AttributeError
and produces None, instead.
Change-Id: I9c9472cdd796b6686d5e7fb46a986ac4366098f2
Fixes: PYSIDE-1727
Pick-to: 6.2 5.15
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
Diffstat (limited to 'sources/shiboken6/libshiboken/signature/signature_extend.cpp')
-rw-r--r-- | sources/shiboken6/libshiboken/signature/signature_extend.cpp | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/sources/shiboken6/libshiboken/signature/signature_extend.cpp b/sources/shiboken6/libshiboken/signature/signature_extend.cpp index b31770048..a90f82910 100644 --- a/sources/shiboken6/libshiboken/signature/signature_extend.cpp +++ b/sources/shiboken6/libshiboken/signature/signature_extend.cpp @@ -163,19 +163,21 @@ static PyObject *handle_doc(PyObject *ob, PyObject *old_descr) name = PyModule_GetName(ob_type_mod.object()); else name = reinterpret_cast<PyTypeObject *>(ob_type_mod.object())->tp_name; - if (handle_doc_in_progress || name == nullptr - || strncmp(name, "PySide6.", 8) != 0) - return PyObject_CallMethodObjArgs(old_descr, - PyMagicName::get(), - ob, nullptr); - handle_doc_in_progress++; - PyObject *res = PyObject_CallFunction( - pyside_globals->make_helptext_func, - "(O)", ob); - handle_doc_in_progress--; - if (res == nullptr) - PyErr_Format(PyExc_AttributeError, "%R object has no `__doc__` attribute", ob); - return res; + PyObject *res{}; + + if (handle_doc_in_progress || name == nullptr || strncmp(name, "PySide6.", 8) != 0) { + res = PyObject_CallMethodObjArgs(old_descr, PyMagicName::get(), ob, nullptr); + } else { + handle_doc_in_progress++; + res = PyObject_CallFunction(pyside_globals->make_helptext_func, "(O)", ob); + handle_doc_in_progress--; + } + + if (res) + return res; + + PyErr_Clear(); + Py_RETURN_NONE; } static PyObject *pyside_cf_get___doc__(PyObject *cf) |