浏览代码

fix: coroutinebased.session.coros changed size when iterate

wangweimin 5 年之前
父节点
当前提交
1de33e4645
共有 1 个文件被更改,包括 1 次插入1 次删除
  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