python: do not report handled EAGAIN error
authorMarek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
Tue, 20 Aug 2019 02:12:41 +0000 (04:12 +0200)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Wed, 21 Aug 2019 11:10:38 +0000 (12:10 +0100)
match_watch_by_token() when returns an error, sets also exception within
python. This is generally the right thing to do, but when
xspy_read_watch() handle EAGAIN error internally, the exception needs to
be cleared. Otherwise it will fail like this:

    xen.lowlevel.xs.Error: (11, 'Resource temporarily unavailable')

    The above exception was the direct cause of the following exception:

    Traceback (most recent call last):
      (...)
        result = self.handle.read_watch()
    SystemError: <method 'read_watch' of 'xen.lowlevel.xs.xs' objects> returned a result with an error set

Fixes f6e1023412 "python: Extract registered watch search logic from xspy_read_watch()"
Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
Acked-by: Wei Liu <wl@xen.org>
tools/python/xen/lowlevel/xs/xs.c

index ea50f86bc3dec5397df58f5002d2c951715e4c42..621039d7a7a1d2dda2ed538ddbb7a20984d15fe2 100644 (file)
@@ -531,6 +531,7 @@ again:
     free(xsval);
 
     if (!val && errno == EAGAIN) {
+        PyErr_Clear();
         goto again;
     }