aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Vinciguerra <pvinci@vinciconsulting.com>2019-06-06 10:49:46 -0400
committerOle Trøan <otroan@employees.org>2019-06-07 09:44:20 +0000
commit4430f450c118b787e2f9eff57a53de1da07246c1 (patch)
tree1a43bfd24b83908b947d7827d7ea6b095743aa0b
parent2f260147f0b22a3f8fe3fa29afcdc0e2e6d61ef7 (diff)
vpp_papi: Fix format_vl_api_address_t under python3.
Under PY3, inet_pton returns OSError, not socket.error. Type: fix Change-Id: Id270a684c0ab124cbe1ddcb7123e14e85af844b8 Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
-rw-r--r--src/vpp-api/python/vpp_papi/vpp_format.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/vpp-api/python/vpp_papi/vpp_format.py b/src/vpp-api/python/vpp_papi/vpp_format.py
index 2c2345a3f76..415070c4196 100644
--- a/src/vpp-api/python/vpp_papi/vpp_format.py
+++ b/src/vpp-api/python/vpp_papi/vpp_format.py
@@ -36,7 +36,9 @@ def format_vl_api_address_t(args):
try:
return {'un': {'ip6': inet_pton(AF_INET6, args)},
'af': ADDRESS_IP6}
- except socket.error as e:
+ # PY2: raises socket.error
+ # PY3: raises OSError
+ except (socket.error, OSError):
return {'un': {'ip4': inet_pton(AF_INET, args)},
'af': ADDRESS_IP4}