diff options
| author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2022-08-02 13:16:47 +0200 |
|---|---|---|
| committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2022-08-02 20:53:04 +0200 |
| commit | 1b0134fd104cb710bc9d619c22fd0bacc0832c05 (patch) | |
| tree | 7c22ce8c8bec9a4058033500fed9d8c2382b9610 /sources/shiboken6/tests/samplebinding/exception_test.py | |
| parent | bc7face18376b52e99079d633da610adc5cc57ef (diff) | |
shiboken6: Propagate exceptions through return value ownership modifications
The code for modifying return value ownership clears errors set by
PyErr_SetString(). To work around this, store the error type and
the message in variables and set the error at the end of the code block.
Fixes: PYSIDE-1995
Change-Id: I45816197117a3b409fd549e89d57f7b9f0eac458
Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
Diffstat (limited to 'sources/shiboken6/tests/samplebinding/exception_test.py')
| -rw-r--r-- | sources/shiboken6/tests/samplebinding/exception_test.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/sources/shiboken6/tests/samplebinding/exception_test.py b/sources/shiboken6/tests/samplebinding/exception_test.py index d502609bf..78e583da0 100644 --- a/sources/shiboken6/tests/samplebinding/exception_test.py +++ b/sources/shiboken6/tests/samplebinding/exception_test.py @@ -55,5 +55,16 @@ class CppExceptionTest(unittest.TestCase): self.assertEqual(exceptionCount, 2) + def testModifications(self): + """PYSIDE-1995, test whether exceptions are propagated + when return ownership modifications are generated.""" + exceptionCount = 0 + try: + et = ExceptionTest.create(True); + except: + exceptionCount += 1 + self.assertEqual(exceptionCount, 1) + + if __name__ == '__main__': unittest.main() |
