Skip to content

Report non-finite integer values as configuration errors - #206

Open
Imkkey wants to merge 1 commit into
beetbox:mainfrom
Imkkey:fix/integer-nonfinite-validation
Open

Imkkey wants to merge 1 commit into
beetbox:mainfrom
Imkkey:fix/integer-nonfinite-validation

Conversation

@Imkkey

@Imkkey Imkkey commented Oct 2, 2026

Copy link
Copy Markdown

Integer currently raises raw OverflowError for infinity and ValueError for NaN. That also prevents OneOf([int, float]) from reaching its valid Number fallback; NaN is incorrectly reported as a ConfigTemplateError.

Catch those float-to-integer conversion failures and raise ConfigValueError with the configuration key instead. Finite floats and arbitrarily large integers keep their existing behavior.

The tests load YAML .inf, -.inf and .nan and cover direct validation, successful OneOf fallback, and rejection when no candidate accepts the value. A changelog entry is included.

Validation on Python 3.12.14:

  • 9 regression cases fail before the fix and pass afterward; 4 finite-number controls also pass
  • All 125 template tests and 312 core tests pass
  • Full suite after building docs: 313 passed, 1 existing failure in test_bump_version_applies_sequential_changelog_updates. A clean upstream checkout has the same failure (300 passed, 1 failed)
  • Ruff lint/format, mypy targeting Python 3.10, strict Sphinx build and changelog checks pass

This branch has not been deployed

No deployments
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