From 6b6d0e0673765f3c4bbc437d1599d7b7fd01f53e Mon Sep 17 00:00:00 2001 From: Antoine Pitrou Date: Sun, 11 Jun 2017 10:41:45 +0200 Subject: [PATCH] Use getitem / setitem idiom on nonlocal list --- tornado/netutil.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tornado/netutil.py b/tornado/netutil.py index 04a3a4bf4..e58db35df 100644 --- a/tornado/netutil.py +++ b/tornado/netutil.py @@ -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 -- 2.47.2