Skip to content

Fix duration format overflow handling - #1525

Closed
wanxiankai wants to merge 1 commit into
python-jsonschema:mainfrom
wanxiankai:fix/duration-overflow-format-check
Closed

wanxiankai wants to merge 1 commit into
python-jsonschema:mainfrom
wanxiankai:fix/duration-overflow-format-check

Conversation

@wanxiankai

Copy link
Copy Markdown

Fixes #1511.

Summary

  • catch decimal parsing exceptions raised by isoduration while checking the duration format
  • add a regression test for large exponent duration strings so they become format validation errors instead of uncaught decimal.Overflow exceptions

Tests

  • .venv/bin/python -m unittest jsonschema.tests.test_format.TestFormatChecker.test_duration_overflow_is_invalid
  • .venv/bin/python -m unittest jsonschema.tests.test_format
  • .venv/bin/virtue jsonschema/tests/test_format.py
  • .venv/bin/python -m ruff check jsonschema/_format.py jsonschema/tests/test_format.py

@read-the-docs-community

Copy link
Copy Markdown

Documentation build overview

📚 python-jsonschema | 🛠️ Build #33653394 | 📁 Comparing 1984400 against latest (0274292)

  🔍 Preview build  

1 file changed
± _modules/jsonschema/_format/index.html

This branch was previously deployed

1 inactive deployment
PyPI — 19844005 Deployed Jul 19, 2026 by wanxiankai via Build and publish #4425
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.

is_duration raises an uncaught decimal.Overflow on a duration with a large exponent

2 participants