From 7dae88f0f5c17a16a298aac97df097e4caca977d Mon Sep 17 00:00:00 2001 From: David Wilson Date: Sun, 27 Jan 2019 18:46:03 +0000 Subject: [PATCH] issue #490: have Side._on_fork() empty _fork_refs This is mostly to avoid ugly debugging that depends on the state of GC. Discard sides from _fork_refs after they have been closed. --- mitogen/core.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mitogen/core.py b/mitogen/core.py index 7a698f43..5cb7761f 100644 --- a/mitogen/core.py +++ b/mitogen/core.py @@ -1415,7 +1415,9 @@ class Side(object): @classmethod def _on_fork(cls): - for side in list(cls._fork_refs.values()): + while cls._fork_refs: + _, side = cls._fork_refs.popitem() + _vv and IOLOG.debug('Side._on_fork() closing %r', side) side.close() def close(self):