Przeglądaj źródła

fix: coroutinebased.session.coros changed size when iterate

wangweimin 5 lat temu
rodzic
commit
1de33e4645
1 zmienionych plików z 1 dodań i 1 usunięć
  1. 1 1
      pywebio/session/coroutinebased.py

+ 1 - 1
pywebio/session/coroutinebased.py

@@ -125,7 +125,7 @@ class CoroutineBasedSession(AbstractSession):
         return msgs
 
     def _cleanup(self):
-        for t in self.coros.values():
+        for t in list(self.coros.values()):  # t.close() may cause self.coros changed size
             t.close()
         self.coros = {}  # delete session tasks
         CoroutineBasedSession._active_session_cnt -= 1