From 6586bca9b9a3d30e3e76ee27bcd98ea5c8c7a57f Mon Sep 17 00:00:00 2001 From: pukkandan Date: Tue, 20 Jul 2021 23:16:38 +0530 Subject: [PATCH] [utils] Fix LazyList for Falsey values --- yt_dlp/utils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/yt_dlp/utils.py b/yt_dlp/utils.py index 25bc59795..4d3cbc7b4 100644 --- a/yt_dlp/utils.py +++ b/yt_dlp/utils.py @@ -6287,8 +6287,8 @@ def _traverse_obj(obj, path, _current_depth=0): if val is not None: if depth: for _ in range(depth - 1): - val = itertools.chain.from_iterable(filter(None, val)) - val = (list(filter(None, val)) if expected_type is None + val = itertools.chain.from_iterable(v for v in val if v is not None) + val = ([v for v in val if v is not None] if expected_type is None else [v for v in val if isinstance(v, expected_type)]) if val: return val