diff options
Diffstat (limited to 'sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/errorhandler.py')
-rw-r--r-- | sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/errorhandler.py | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/errorhandler.py b/sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/errorhandler.py index 6b428e613..c2a19efef 100644 --- a/sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/errorhandler.py +++ b/sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/errorhandler.py @@ -1,6 +1,8 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +# flake8: noqa E:721 + """ errorhandler.py @@ -19,12 +21,10 @@ This matter will be improved in a later version. """ import collections.abc -import inspect -import sys import typing from shibokensupport.signature import get_signature -from shibokensupport.signature.mapping import update_mapping, namespace +from shibokensupport.signature.mapping import namespace from textwrap import dedent @@ -77,8 +77,8 @@ def seterror_argument(args, func_name, info): if info == "<": msg = f"{func_name}(): not enough arguments" elif info == "0": - msg = (f"{func_name}(): not enough arguments. " - "Note: keyword arguments are only supported for optional parameters.") + msg = (f"{func_name}(): not enough arguments. " + "Note: keyword arguments are only supported for optional parameters.") elif info == ">": msg = f"{func_name}(): too many arguments" elif info.isalnum(): @@ -87,6 +87,12 @@ def seterror_argument(args, func_name, info): msg = f"{func_name}(): {info}" err = AttributeError return err, msg + if isinstance(info, Exception): + # PYSIDE-2230: Python 3.12 seems to always do normalization. + err = type(info) + info = info.args[0] + msg = f"{func_name}(): {info}" + return err, msg if info and type(info) is dict: msg = f"{func_name}(): unsupported keyword '{tuple(info)[0]}'" return AttributeError, msg @@ -126,6 +132,8 @@ def check_string_type(s): def make_helptext(func): existing_doc = func.__doc__ + if existing_doc is None and hasattr(func, "__dict__"): + existing_doc = func.__dict__.get("__doc__") sigs = get_signature(func) if not sigs: return existing_doc |