Skip to content

Avoid crashes on nondecimal numeric ordered-list starts - #291

Open
Doyoubelieveinfate wants to merge 1 commit into
matthewwithanm:developfrom
Doyoubelieveinfate:fix/non-decimal-list-start
Open

Doyoubelieveinfate wants to merge 1 commit into
matthewwithanm:developfrom
Doyoubelieveinfate:fix/non-decimal-list-start

Conversation

@Doyoubelieveinfate

Copy link
Copy Markdown

Converting <ol start="²"><li>a</li></ol> raises ValueError because isnumeric() accepts characters that int() cannot parse. Roman numerals, fractions and Chinese numerals also stop the entire HTML conversion instead of using the existing fallback for an invalid start value.

Use isdecimal() for the conversion guard. Nondecimal numeric characters now fall back to numbering from 1. Decimal digits already accepted by int(), including Arabic-Indic and fullwidth digits, keep their behavior.

Validation on macOS/Python 3.13.5:

  • Four new invalid-start cases raise before the fix and pass afterward; three decimal-start controls also pass.
  • Full suite: 90 tests pass.
  • Flake8, README reStructuredText lint, mypy and strict public-type tests pass.
  • git diff --check passes.
  • Reviewed invalid-value fallback, preservation of decimal numbering, and the existing nested-list and negative-start tests.

Prepared, tested and reviewed with Codex at the account owner's request.

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