diff options
| author | Christian Tismer <tismer@stackless.com> | 2021-12-07 15:55:14 +0100 |
|---|---|---|
| committer | Christian Tismer <tismer@stackless.com> | 2021-12-08 12:56:12 +0100 |
| commit | 9fddacfdf636e7f5eab037beef09a8974b9d8d55 (patch) | |
| tree | fc92bad1cabe7844d74a8dd705e2a45e2b94c7c8 | |
| parent | 9dcc454ee166806a5a20516021f82f619bc39b99 (diff) | |
Signature: fix the __doc__ attribute of classes
The signature module had been changed to no longer default
the __doc__ attribute of classes to the __init__ signature.
This has the side effect of crashing "help(QtCore)".
Fixed by correct defaults in C++ (AttributeError) and by
setting a "None" default in the Python handler.
The make_helptest function defaults again correctly to the signature:
>>> errorhandler.make_helptext(QtWidgets.QApplication)
'QApplication(self) -> None\nQApplication(self, arg__1: Sequence[str]) -> None'
Change-Id: I140f2b940f98eb126541b18b0feb312c7c4e9728
Fixes: PYSIDE-1727
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
(cherry picked from commit 8901719fd74ce8d8909608365e68f7354adaa254)
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
| -rw-r--r-- | sources/shiboken2/libshiboken/signature/signature_extend.cpp | 6 | ||||
| -rw-r--r-- | sources/shiboken2/shibokenmodule/files.dir/shibokensupport/signature/errorhandler.py | 2 |
2 files changed, 3 insertions, 5 deletions
diff --git a/sources/shiboken2/libshiboken/signature/signature_extend.cpp b/sources/shiboken2/libshiboken/signature/signature_extend.cpp index 49ccca0bd..3d4f364f1 100644 --- a/sources/shiboken2/libshiboken/signature/signature_extend.cpp +++ b/sources/shiboken2/libshiboken/signature/signature_extend.cpp @@ -153,10 +153,8 @@ static PyObject *handle_doc(PyObject *ob, PyObject *old_descr) pyside_globals->make_helptext_func, const_cast<char *>("(O)"), ob); handle_doc_in_progress--; - if (res == nullptr) { - PyErr_Print(); - Py_FatalError("handle_doc did not receive a result"); - } + if (res == nullptr) + PyErr_Format(PyExc_AttributeError, "%R object has no `__doc__` attribute", ob); return res; } diff --git a/sources/shiboken2/shibokenmodule/files.dir/shibokensupport/signature/errorhandler.py b/sources/shiboken2/shibokenmodule/files.dir/shibokensupport/signature/errorhandler.py index 375b279f1..67ab0d045 100644 --- a/sources/shiboken2/shibokenmodule/files.dir/shibokensupport/signature/errorhandler.py +++ b/sources/shiboken2/shibokenmodule/files.dir/shibokensupport/signature/errorhandler.py @@ -136,7 +136,7 @@ def check_string_type(s): return isinstance(s, (str, unicode)) def make_helptext(func): - existing_doc = func.__doc__ + existing_doc = func.__doc__ if hasattr(func, "__doc__") else None sigs = get_signature(func) if not sigs: return existing_doc |
