aboutsummaryrefslogtreecommitdiffstats
path: root/sources
diff options
context:
space:
mode:
authorChristian Tismer <tismer@stackless.com>2020-11-24 18:33:13 +0100
committerChristian Tismer <tismer@stackless.com>2020-11-25 07:45:24 +0000
commit0e03a2524e1d98f717f204252e155762e0439e93 (patch)
treec0755b232b37419ac2528b1d1f9a23e5c0f6d5b6 /sources
parentd5bc255aa50a9181a3258b17c07b8da0890cb035 (diff)
errorhandler.py: use AttributeError instead of TypeError
There is a small improvement needed in errorhandler.py: It was not consequent to use TypeError for missing attributes in one case, and to use AttributeError on the constructors. The error message may be different, but it always should be AttributeError. Task-number: PYSIDE-1305 Task-number: PYSIDE-1019 Change-Id: I1c278c5256000f0f0fe66ca9da36c2d078002b25 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'sources')
-rw-r--r--sources/pyside6/tests/pysidetest/constructor_properties_test.py2
-rw-r--r--sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/errorhandler.py2
2 files changed, 2 insertions, 2 deletions
diff --git a/sources/pyside6/tests/pysidetest/constructor_properties_test.py b/sources/pyside6/tests/pysidetest/constructor_properties_test.py
index 9892c618d..fbfbdffeb 100644
--- a/sources/pyside6/tests/pysidetest/constructor_properties_test.py
+++ b/sources/pyside6/tests/pysidetest/constructor_properties_test.py
@@ -79,7 +79,7 @@ class DiverseKeywordsTest(UsesQApplication):
def testUndefinedKeyword(self):
r, g, b, a = 1, 2, 3, 4
# From the jira issue:
- with self.assertRaises(TypeError) as cm:
+ with self.assertRaises(AttributeError) as cm:
QColor(r, g, b, a, alpha=0)
self.assertTrue("unsupported" in cm.exception.args[0])
diff --git a/sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/errorhandler.py b/sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/errorhandler.py
index 76d2f2e9b..7af7b48b2 100644
--- a/sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/errorhandler.py
+++ b/sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/errorhandler.py
@@ -114,7 +114,7 @@ def seterror_argument(args, func_name, info):
return err, msg
if info and type(info) is dict:
msg = f"{func_name}(): unsupported keyword '{tuple(info)[0]}'"
- return TypeError, msg
+ return AttributeError, msg
sigs = get_signature(func, "typeerror")
if not sigs:
msg = f"{func_name}({args}) is wrong (missing signature)"