From ac492887d655e8cb14f28654260def3f2ee10929 Mon Sep 17 00:00:00 2001
From: Michael Hanselmann <hansmi@google.com>
Date: Thu, 1 Jul 2010 13:45:49 +0200
Subject: [PATCH] utils.OwnIpAddress: Change try/except for Python 2.4
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Python 2.4 doesn't support β€œexcept” and β€œfinally” in the same block.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
---
 lib/utils.py | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/lib/utils.py b/lib/utils.py
index f57cb8830..8972b2e53 100644
--- a/lib/utils.py
+++ b/lib/utils.py
@@ -1807,10 +1807,11 @@ def OwnIpAddress(address):
   s = socket.socket(family, socket.SOCK_DGRAM)
   success = False
   try:
-    s.bind((address, 0))
-    success = True
-  except socket.error:
-    success = False
+    try:
+      s.bind((address, 0))
+      success = True
+    except socket.error:
+      success = False
   finally:
     s.close()
   return success
-- 
GitLab