diff mbox

[ovs-dev,V11,09/17] python tests: Fixed OSError not iterable on Windows

Message ID CAM_3v9K-z3uNPz21Sik4sTy6RA8uaTkThtLS-rqYp2e9RcppvA@mail.gmail.com
State Not Applicable
Headers show

Commit Message

Gurucharan Shetty Aug. 3, 2016, 3:56 p.m. UTC
On 2 August 2016 at 10:45, Paul Boca <pboca@cloudbasesolutions.com> wrote:

> On Windows if this exception is triggered then it will raise an exception
> while in the
> exception handler.
>
> Signed-off-by: Paul-Daniel Boca <pboca@cloudbasesolutions.com>
> Acked-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
>

I added the following incremental and applied this.
                 # XXX rate-limit


> ---
> V2: No changes
> V3: No changes
> V4: No changes
> V5: No changes
> V6: No changes
> V7: No changes
> V8: Added comment when using OSError on Windows
> V9: No changes
> V10: No changes
> V11: No changes
> ---
>  python/ovs/poller.py | 7 +++++++
>  1 file changed, 7 insertions(+)
>
> diff --git a/python/ovs/poller.py b/python/ovs/poller.py
> index 20be801..3ebaf5a 100644
> --- a/python/ovs/poller.py
> +++ b/python/ovs/poller.py
> @@ -17,6 +17,7 @@ import ovs.timeval
>  import ovs.vlog
>  import select
>  import socket
> +import os
>
>  try:
>      import eventlet.patcher
> @@ -168,6 +169,12 @@ class Poller(object):
>              try:
>                  events = self.poll.poll(self.timeout)
>                  self.__log_wakeup(events)
> +            except OSError as e:
> +                """ On Windows, the select function from poll raises
> OSError
> +                exception if the polled array is empty."""
> +                error = e.errno
> +                if error != errno.EINTR:
> +                    vlog.err("poll: %s" % os.strerror(e.errno))
>              except select.error as e:
>                  # XXX rate-limit
>                  error, msg = e
> --
> 2.7.2.windows.1
> _______________________________________________
> dev mailing list
> dev@openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev
>
diff mbox

Patch

diff --git a/python/ovs/poller.py b/python/ovs/poller.py
index 3ebaf5a..de6bf22 100644
--- a/python/ovs/poller.py
+++ b/python/ovs/poller.py
@@ -172,8 +172,7 @@  class Poller(object):
             except OSError as e:
                 """ On Windows, the select function from poll raises
OSError
                 exception if the polled array is empty."""
-                error = e.errno
-                if error != errno.EINTR:
+                if e.errno != errno.EINTR:
                     vlog.err("poll: %s" % os.strerror(e.errno))
             except select.error as e: