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

Pavel Hrdina phrdina at redhat.com
Tue Jun 12 05:16:40 UTC 2018


In virConnectCredCallbackWrapper() we ignore the error case of
libvirt_charPtrUnwrap() function so we should also reset the exception.

Signed-off-by: Pavel Hrdina <phrdina at 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




More information about the libvir-list mailing list