]> git.ipfire.org Git - thirdparty/tornado.git/commitdiff
Use getitem / setitem idiom on nonlocal list 2075/head
authorAntoine Pitrou <antoine@python.org>
Sun, 11 Jun 2017 08:41:45 +0000 (10:41 +0200)
committerAntoine Pitrou <antoine@python.org>
Sun, 11 Jun 2017 08:41:45 +0000 (10:41 +0200)
tornado/netutil.py

index 04a3a4bf45792cc4ed1e32760a026a36aa0b2f2f..e58db35df7e32248cfbf12450f454d01bc5f3f49 100644 (file)
@@ -251,7 +251,7 @@ def add_accept_handler(sock, callback):
        A callable is returned (``None`` was returned before).
     """
     io_loop = IOLoop.current()
-    removed = []
+    removed = [False]
 
     def accept_handler(fd, events):
         # More connections may come in while we're handling callbacks;
@@ -266,7 +266,7 @@ def add_accept_handler(sock, callback):
         # heuristic for the number of connections we can reasonably
         # accept at once.
         for i in xrange(_DEFAULT_BACKLOG):
-            if removed:
+            if removed[0]:
                 # The socket was probably closed
                 return
             try:
@@ -287,7 +287,7 @@ def add_accept_handler(sock, callback):
 
     def remove_handler():
         io_loop.remove_handler(sock)
-        removed.append(True)
+        removed[0] = True
 
     io_loop.add_handler(sock, accept_handler, IOLoop.READ)
     return remove_handler