From a9bd1d2f18e0ae4c434aff1cd32e5e98324c1b73 Mon Sep 17 00:00:00 2001 From: Hafiz Shehbaz Ali Date: Wed, 9 Sep 2020 08:21:51 +0400 Subject: [PATCH] empty list cannot be cleared issue fixed. (#14882) * empty list cannot be cleared issue fixed. * Update multiproc_data.py Co-authored-by: Sheng Zha --- example/ctc/multiproc_data.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/example/ctc/multiproc_data.py b/example/ctc/multiproc_data.py index f4c667621f70..b33aa49f1a46 100644 --- a/example/ctc/multiproc_data.py +++ b/example/ctc/multiproc_data.py @@ -48,7 +48,7 @@ def __init__(self, num_processes, max_queue_size, fn): self.queue = mp.Queue(maxsize=int(max_queue_size)) self.alive = mp.Value(c_bool, False, lock=False) self.num_proc = num_processes - self.proc = list() + self.proc = [] self.fn = fn def start(self): @@ -122,4 +122,5 @@ def reset(self): print("Queue size on reset: {}".format(qsize)) for i, p in enumerate(self.proc): p.join() - self.proc.clear() + if self.proc: + self.proc = []