diff --git a/sip/siplib/sip.h b/sip/siplib/sip.h index bcb53ab2..5dc022ee 100644 --- a/sip/siplib/sip.h +++ b/sip/siplib/sip.h @@ -1,7 +1,7 @@ /* * The SIP module interface. * - * Copyright (c) 2018 Riverbank Computing Limited + * Copyright (c) 2020 Riverbank Computing Limited * * This file is part of SIP. * @@ -54,8 +54,8 @@ extern "C" { /* * Define the SIP version number. */ -#define SIP_VERSION 0x041313 -#define SIP_VERSION_STR "4.19.19" +#define SIP_VERSION 0x041317 +#define SIP_VERSION_STR "4.19.23" /* diff --git a/sip/siplib/siplib.c b/sip/siplib/siplib.c index e2c90784..a31ddbec 100644 --- a/sip/siplib/siplib.c +++ b/sip/siplib/siplib.c @@ -1,7 +1,7 @@ /* * SIP library code. * - * Copyright (c) 2019 Riverbank Computing Limited + * Copyright (c) 2020 Riverbank Computing Limited * * This file is part of SIP. * @@ -9338,6 +9338,7 @@ static PyObject *sip_api_get_reference(PyObject *self, int key) return NULL; obj = PyDict_GetItem(dict, key_obj); + Py_DECREF(key_obj); Py_XINCREF(obj); return obj; @@ -11320,6 +11321,11 @@ static SIP_SSIZE_T sipSimpleWrapper_getcharbuffer(sipSimpleWrapper *self, */ static void sipSimpleWrapper_dealloc(sipSimpleWrapper *self) { + PyObject *error_type, *error_value, *error_traceback; + + /* Save the current exception, if any. */ + PyErr_Fetch(&error_type, &error_value, &error_traceback); + forgetObject(self); /* @@ -11331,6 +11337,9 @@ static void sipSimpleWrapper_dealloc(sipSimpleWrapper *self) /* Call the standard super-type dealloc. */ PyBaseObject_Type.tp_dealloc((PyObject *)self); + + /* Restore the saved exception. */ + PyErr_Restore(error_type, error_value, error_traceback); } @@ -11727,6 +11736,11 @@ static int sipWrapper_clear(sipWrapper *self) */ static void sipWrapper_dealloc(sipWrapper *self) { + PyObject *error_type, *error_value, *error_traceback; + + /* Save the current exception, if any. */ + PyErr_Fetch(&error_type, &error_value, &error_traceback); + /* * We can't simply call the super-type because things have to be done in a * certain order. The first thing is to get rid of the wrapped instance. @@ -11737,6 +11751,9 @@ static void sipWrapper_dealloc(sipWrapper *self) /* Skip the super-type's dealloc. */ PyBaseObject_Type.tp_dealloc((PyObject *)self); + + /* Restore the saved exception. */ + PyErr_Restore(error_type, error_value, error_traceback); }