Skip to content

Commit 83e1496

Browse files
committed
Minor refactor
1 parent 9ad5d9d commit 83e1496

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

byexample/init.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -708,10 +708,15 @@ def init_worker(cfg, job_num):
708708
If the recreation process is thread safe (depends of the objects'
709709
implementations), then init_worker is thread safe.
710710
'''
711-
# let the rest of byexample for this worker to know
711+
patch = {}
712+
# Patch the job_number: let the rest of byexample for this worker to know
712713
# in which worker is on
713714
assert cfg['job_number'] == '__main__'
714-
cfg = cfg.copy(patch={'job_number': int(job_num)})
715+
patch['job_number'] = int(job_num)
716+
717+
# Get an independent copy of cfg (and therefore, thread-safe)
718+
# with some keys patched
719+
cfg = cfg.copy(patch=patch)
715720

716721
concerns = ConcernComposite(**cfg)
717722

0 commit comments

Comments
 (0)