From 0e068ff7d19b37fc56f23cee2774593634d35f08 2019-05-27 13:14:57 From: Nikita Bezdolniy Date: 2019-05-27 13:14:57 Subject: [PATCH] Fixes #11603 job.num is now calculated independently of current job count and increments throughout all jobs --- diff --git a/IPython/lib/backgroundjobs.py b/IPython/lib/backgroundjobs.py index ebd70d3..31997e1 100644 --- a/IPython/lib/backgroundjobs.py +++ b/IPython/lib/backgroundjobs.py @@ -86,6 +86,7 @@ class BackgroundJobManager(object): self._s_running = BackgroundJobBase.stat_running_c self._s_completed = BackgroundJobBase.stat_completed_c self._s_dead = BackgroundJobBase.stat_dead_c + self._current_job_id = 0 @property def running(self): @@ -187,7 +188,8 @@ class BackgroundJobManager(object): if kwargs.get('daemon', False): job.daemon = True - job.num = len(self.all)+1 if self.all else 0 + job.num = self._current_job_id + self._current_job_id += 1 self.running.append(job) self.all[job.num] = job debug('Starting job # %s in a separate thread.' % job.num)