From eab6a2c73ca49a5144da6449c054a5899bd211dc Mon Sep 17 00:00:00 2001 From: baldurk Date: Tue, 13 Dec 2022 11:12:45 +0000 Subject: [PATCH] Fix python comparison operators throwing exceptions * When used in richcompare this would throw an exception and return Py_NotImplemented causing a failure. Instead we should just return NULL, which is fine and will be considered as a not-equal comparison for equality/inequality and throw the kind of exception we want for less than or greater than. --- qrenderdoc/Code/pyrenderdoc/cosmetics.i | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/qrenderdoc/Code/pyrenderdoc/cosmetics.i b/qrenderdoc/Code/pyrenderdoc/cosmetics.i index 34980c900..2fbc03d1c 100644 --- a/qrenderdoc/Code/pyrenderdoc/cosmetics.i +++ b/qrenderdoc/Code/pyrenderdoc/cosmetics.i @@ -22,7 +22,7 @@ PyObject *__lt__(PyObject *other) { int res = SWIG_ConvertPtr(other, &resptr, SWIGTYPE_p_ResourceId, 0); if (!SWIG_IsOK(res)) { - SWIG_exception_fail(SWIG_ArgError(res), "incorrect comparison type"); + goto fail; } id = (ResourceId *)resptr; @@ -129,7 +129,7 @@ PyObject *__eq__(PyObject *other) { int res = SWIG_ConvertPtr(other, &resptr, SWIGTYPE_p_##Class, 0); if (!SWIG_IsOK(res)) { - SWIG_exception_fail(SWIG_ArgError(res), "incorrect comparison type"); + goto fail; } id = (Class *)resptr; @@ -152,7 +152,7 @@ PyObject *__ne__(PyObject *other) { int res = SWIG_ConvertPtr(other, &resptr, SWIGTYPE_p_##Class, 0); if (!SWIG_IsOK(res)) { - SWIG_exception_fail(SWIG_ArgError(res), "incorrect comparison type"); + goto fail; } id = (Class *)resptr;