소스 검색

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