From f93700421ef3a92e527c039a8f10539044f51b9c Mon Sep 17 00:00:00 2001 From: bashonly Date: Wed, 11 Jun 2025 10:01:44 -0500 Subject: [PATCH] [devalue] simplify guarding against Python negative indexing Authored by: bashonly --- yt_dlp/utils/web/devalue.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/yt_dlp/utils/web/devalue.py b/yt_dlp/utils/web/devalue.py index 2179925a1..a922c7ab2 100644 --- a/yt_dlp/utils/web/devalue.py +++ b/yt_dlp/utils/web/devalue.py @@ -41,7 +41,6 @@ def parse_iter(parsed: typing.Any, /, *, revivers: dict[str, collections.abc.Cal -5: -math.inf, -6: -0.0, } - lowest_valid_index = min(resolved.keys()) if isinstance(parsed, int): if parsed == -2: @@ -70,7 +69,7 @@ def parse_iter(parsed: typing.Any, /, *, revivers: dict[str, collections.abc.Cal target[index] = resolved[source] continue - if source < lowest_valid_index: + if source < 0: yield IndexError(f'invalid index: {source!r}') continue