Skip to content

Reject negative subtitle word limits instead of looping forever - #2869

Open
Shubham-Padkonde wants to merge 1 commit into
openai:mainfrom
Shubham-Padkonde:fix/negative-subtitle-word-limit
Open

Shubham-Padkonde wants to merge 1 commit into
openai:mainfrom
Shubham-Padkonde:fix/negative-subtitle-word-limit

Conversation

@Shubham-Padkonde

Copy link
Copy Markdown

A negative max_words_per_line makes the subtitle writer loop forever: chunk_index moves backward while the loop condition remains true. This affects both SRT and VTT word-timestamp output, including values supplied through the options dictionary.

Reject negative limits before iterating. Keep the existing behavior for None and zero (no explicit limit), and for positive limits.

Validation: reproduced the original hang in a subprocess stopped after three seconds. Four initial rejection tests fail on the original implementation. All 24 writer, normalizer, and tokenizer tests pass with the fix; Black, isort, flake8, and git diff --check pass. Added coverage for empty and populated results, both subtitle formats, both option paths, and unchanged positive/zero/default behavior. Model inference tests were not run for this writer-only change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant