diff options
author | Christian Tismer <tismer@stackless.com> | 2020-12-08 14:20:46 +0100 |
---|---|---|
committer | Christian Tismer <tismer@stackless.com> | 2020-12-08 17:31:19 +0100 |
commit | 50e059098260caaef33a1e2b19e9d76a85d2a32c (patch) | |
tree | e56fa7fd93d553912ffeb8a02fab3589e3a50103 | |
parent | c6184e01e993dcca9798f306fb8e9cb322fdd0dc (diff) |
cppgenerator: rework keyword handling regarding unknown.. Fixed!
The new keyword algorithm did fail again on Windows.
But this time it was a refcounting error that was only visible
in a debug build.
On Windows, it appeared as a negative refcount assertion.
On macOS in debug mode, it was a segfault instead.
The problem was `PyErr_Fetch()`, a function that uses borrowed
references, only. Forgot to respect that, sorry :-(
Task-number: PYSIDE-1305
Change-Id: I164668db8143729fa2fab0be1f61757690e13138
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
(cherry picked from commit 76a72315de6cd9ea2f76109a3896d95db4227f64)
-rw-r--r-- | sources/shiboken2/libshiboken/signature/signature.cpp | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/sources/shiboken2/libshiboken/signature/signature.cpp b/sources/shiboken2/libshiboken/signature/signature.cpp index 1f36a09f3..4c251af5b 100644 --- a/sources/shiboken2/libshiboken/signature/signature.cpp +++ b/sources/shiboken2/libshiboken/signature/signature.cpp @@ -525,13 +525,11 @@ void SetError_Argument(PyObject *args, const char *func_name, PyObject *info) init_module_2(); // PYSIDE-1305: Handle errors set by fillQtProperties. - PyObject *err_val{}; if (PyErr_Occurred()) { - PyObject *e, *t; - PyErr_Fetch(&e, &err_val, &t); - info = err_val; - Py_XDECREF(&e); - Py_XDECREF(&t); + PyObject *e, *v, *t; + // Note: These references are all borrowed. + PyErr_Fetch(&e, &v, &t); + info = v; } // PYSIDE-1019: Modify the function name expression according to feature. AutoDecRef new_func_name(adjustFuncName(func_name)); @@ -552,7 +550,6 @@ void SetError_Argument(PyObject *args, const char *func_name, PyObject *info) PyErr_Print(); Py_FatalError("unexpected failure in seterror_argument"); } - Py_XDECREF(err_val); PyErr_SetObject(err, msg); } |