From 46323ae6ff7acd459b3bda4f24ed0baecc829885 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Sat, 28 Nov 2020 18:13:46 +0100 Subject: [PATCH] initialize 'hooks' as empty tuple follow-up to 9c29fc4e Prevent a "race" between initializing 'pathfmt' and 'hooks', and receiving a signal in between (e.g. ctrl+c), which would then crash in 'handle_finalize()'. --- gallery_dl/job.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gallery_dl/job.py b/gallery_dl/job.py index 570c7793..c1d32ef1 100644 --- a/gallery_dl/job.py +++ b/gallery_dl/job.py @@ -194,7 +194,7 @@ class DownloadJob(Job): self.blacklist = None self.archive = None self.sleep = None - self.hooks = None + self.hooks = () self.downloaders = {} self.out = output.select() @@ -411,9 +411,9 @@ class DownloadJob(Job): if self.archive: self.archive.check = pathfmt.exists - self.hooks = collections.defaultdict(list) postprocessors = self.extractor.config_accumulate("postprocessors") if postprocessors: + self.hooks = collections.defaultdict(list) pp_log = self.get_logger("postprocessor") pp_list = [] category = self.extractor.category