diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2022-06-15 09:29:49 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2022-06-15 19:49:46 +0200 |
commit | 3977c518195289edf7802d0d1b10ba3c2d49dd96 (patch) | |
tree | e5347b660a410ee429d82ac10fc0efab64eb183b /sources | |
parent | 20eb4f94c637d20461f1fef16942841803ada909 (diff) |
libshiboken: Amend error message "not enough arguments"
In case no arguments at all were passed (assuming they were passed as
keyword arguments which only works for optional arguments), add a note
about that.
Task-number: PYSIDE-1964
Pick-to: 6.3 6.2
Change-Id: Iacaef7604f6127ce6532b31dabba8dd93e45bc78
Reviewed-by: Christian Tismer <tismer@stackless.com>
Diffstat (limited to 'sources')
-rw-r--r-- | sources/shiboken6/libshiboken/basewrapper.cpp | 3 | ||||
-rw-r--r-- | sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/errorhandler.py | 3 |
2 files changed, 5 insertions, 1 deletions
diff --git a/sources/shiboken6/libshiboken/basewrapper.cpp b/sources/shiboken6/libshiboken/basewrapper.cpp index fce6984c9..f1622c30b 100644 --- a/sources/shiboken6/libshiboken/basewrapper.cpp +++ b/sources/shiboken6/libshiboken/basewrapper.cpp @@ -747,7 +747,8 @@ PyObject *checkInvalidArgumentCount(Py_ssize_t numArgs, Py_ssize_t minArgs, Py_s Py_INCREF(result); } else if (numArgs < minArgs) { static PyObject *const tooFew = Shiboken::String::createStaticString("<"); - result = tooFew; + static PyObject *const noArgs = Shiboken::String::createStaticString("0"); + result = numArgs > 0 ? tooFew : noArgs; Py_INCREF(result); } return result; diff --git a/sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/errorhandler.py b/sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/errorhandler.py index 541a235a9..6b428e613 100644 --- a/sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/errorhandler.py +++ b/sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/errorhandler.py @@ -76,6 +76,9 @@ def seterror_argument(args, func_name, info): err = TypeError 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.") elif info == ">": msg = f"{func_name}(): too many arguments" elif info.isalnum(): |