mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2025-06-28 09:28:33 +00:00
[devalue] simplify guarding against Python negative indexing
Authored by: bashonly
This commit is contained in:
parent
9de99f569d
commit
f93700421e
@ -41,7 +41,6 @@ def parse_iter(parsed: typing.Any, /, *, revivers: dict[str, collections.abc.Cal
|
|||||||
-5: -math.inf,
|
-5: -math.inf,
|
||||||
-6: -0.0,
|
-6: -0.0,
|
||||||
}
|
}
|
||||||
lowest_valid_index = min(resolved.keys())
|
|
||||||
|
|
||||||
if isinstance(parsed, int):
|
if isinstance(parsed, int):
|
||||||
if parsed == -2:
|
if parsed == -2:
|
||||||
@ -70,7 +69,7 @@ def parse_iter(parsed: typing.Any, /, *, revivers: dict[str, collections.abc.Cal
|
|||||||
target[index] = resolved[source]
|
target[index] = resolved[source]
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if source < lowest_valid_index:
|
if source < 0:
|
||||||
yield IndexError(f'invalid index: {source!r}')
|
yield IndexError(f'invalid index: {source!r}')
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user