aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken2/tests/samplebinding
diff options
context:
space:
mode:
authorRenato Araujo Oliveira Filho <renato.araujo@kdab.com>2019-07-31 16:34:28 -0300
committerRenato Araujo Oliveira Filho <renato.araujo@kdab.com>2019-08-07 16:34:47 -0300
commitefc7ad5498ff03de8a444a8c1d880f949aaf4d43 (patch)
treed5ee27861fcd65786aa813b06ae0dce8d642e7cf /sources/shiboken2/tests/samplebinding
parent68b2245519570314a983baa7cda850ace13f7f81 (diff)
Fix crash when accessing a invalid property in the smart pointer
Sbk_*_getattro receives an utf8 string and we need to convert it to ascii string before use it on PyErr_Format. Change-Id: Ie3cf5286c9eb6b01f86347b00d523837ca41de32 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
Diffstat (limited to 'sources/shiboken2/tests/samplebinding')
-rw-r--r--sources/shiboken2/tests/samplebinding/objecttype_test.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/sources/shiboken2/tests/samplebinding/objecttype_test.py b/sources/shiboken2/tests/samplebinding/objecttype_test.py
index bda14c69c..f1a06c2b1 100644
--- a/sources/shiboken2/tests/samplebinding/objecttype_test.py
+++ b/sources/shiboken2/tests/samplebinding/objecttype_test.py
@@ -118,5 +118,13 @@ class ObjectTypeTest(unittest.TestCase):
self.assertLess(abs(before - after), 5)
+ def testInvalidProperty(self):
+ o = ObjectType()
+ try:
+ o.typo
+ self.assertFail()
+ except AttributeError as error:
+ self.assertEqual(error.args[0], "'sample.ObjectType' object has no attribute 'typo'")
+
if __name__ == '__main__':
unittest.main()