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()'.
This commit is contained in:
Mike Fährmann
2020-11-28 18:13:46 +01:00
parent 06af57e84a
commit 46323ae6ff

View File

@@ -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