[Python-checkins] cpython: remove uneffective 'while True' clause

giampaolo.rodola python-checkins at python.org
Wed Apr 3 12:02:06 CEST 2013


http://hg.python.org/cpython/rev/660d6a4bfce9
changeset:   83075:660d6a4bfce9
user:        Giampaolo Rodola' <g.rodola at gmail.com>
date:        Wed Apr 03 12:01:44 2013 +0200
summary:
  remove uneffective 'while True' clause

files:
  Lib/ssl.py |  21 ++++++++++-----------
  1 files changed, 10 insertions(+), 11 deletions(-)


diff --git a/Lib/ssl.py b/Lib/ssl.py
--- a/Lib/ssl.py
+++ b/Lib/ssl.py
@@ -420,18 +420,17 @@
                 raise ValueError(
                     "non-zero flags not allowed in calls to send() on %s" %
                     self.__class__)
-            while True:
-                try:
-                    v = self._sslobj.write(data)
-                except SSLError as x:
-                    if x.args[0] == SSL_ERROR_WANT_READ:
-                        return 0
-                    elif x.args[0] == SSL_ERROR_WANT_WRITE:
-                        return 0
-                    else:
-                        raise
+            try:
+                v = self._sslobj.write(data)
+            except SSLError as x:
+                if x.args[0] == SSL_ERROR_WANT_READ:
+                    return 0
+                elif x.args[0] == SSL_ERROR_WANT_WRITE:
+                    return 0
                 else:
-                    return v
+                    raise
+            else:
+                return v
         else:
             return socket.send(self, data, flags)
 

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list