[libvirt] [python PATCH 3/4] libvirt-override: Reset exception if the error is ignored

Pavel Hrdina posted 4 patches 6 years, 11 months ago
[libvirt] [python PATCH 3/4] libvirt-override: Reset exception if the error is ignored
Posted by Pavel Hrdina 6 years, 11 months ago
In virConnectCredCallbackWrapper() we ignore the error case of
libvirt_charPtrUnwrap() function so we should also reset the exception.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
---
 libvirt-override.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libvirt-override.c b/libvirt-override.c
index 1c95c18..dac481b 100644
--- a/libvirt-override.c
+++ b/libvirt-override.c
@@ -1918,8 +1918,10 @@ virConnectCredCallbackWrapper(virConnectCredentialPtr cred,
             char *result = NULL;
             pycreditem = PyTuple_GetItem(pycred, i);
             pyresult = PyList_GetItem(pycreditem, 4);
-            if (pyresult != Py_None)
+            if (pyresult != Py_None) {
                 libvirt_charPtrUnwrap(pyresult, &result);
+                PyErr_Clear();
+            }
             if (result != NULL) {
                 cred[i].result = result;
                 cred[i].resultlen = strlen(result);
-- 
2.17.1

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [python PATCH 3/4] libvirt-override: Reset exception if the error is ignored
Posted by Ján Tomko 6 years, 11 months ago
On Tue, Jun 12, 2018 at 07:16:40AM +0200, Pavel Hrdina wrote:
>In virConnectCredCallbackWrapper() we ignore the error case of
>libvirt_charPtrUnwrap() function so we should also reset the exception.
>
>Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
>---
> libvirt-override.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)

Reviewed-by: Ján Tomko <jtomko@redhat.com>

Jano
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list