Skip to content

Reject empty bullets option with a clear error#268

Open
santhreal wants to merge 1 commit into
matthewwithanm:developfrom
santhreal:fix/empty-bullets-zerodivision
Open

Reject empty bullets option with a clear error#268
santhreal wants to merge 1 commit into
matthewwithanm:developfrom
santhreal:fix/empty-bullets-zerodivision

Conversation

@santhreal

Copy link
Copy Markdown

An empty bullets option ('', [], or ()) makes convert_li evaluate bullets[depth % len(bullets)], which raises an opaque ZeroDivisionError deep in unordered-list conversion the first time a list is converted (construction succeeds, so the cause is hard to spot).

This validates bullets at construction and raises a clear ValueError, matching the existing strip/convert check. Non-empty bullets (str or list) are unaffected.

Added test_empty_bullets_rejected and test_non_empty_bullets_still_accepted in tests/test_args.py.

An empty bullets sequence (e.g. bullets='' or bullets=[]) made convert_li
evaluate bullets[depth % len(bullets)], raising an opaque ZeroDivisionError
deep in unordered-list conversion. Validate it at construction and raise a
clear ValueError, matching the existing strip/convert check.
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