Skip to content

fix: treat oversized list indices as missing placeholder segments - #93

Open
atishay-kasliwal wants to merge 1 commit into
intuit:mainfrom
atishay-kasliwal:bugfix/91-oversized-index-fallback
Open

atishay-kasliwal wants to merge 1 commit into
intuit:mainfrom
atishay-kasliwal:bugfix/91-oversized-index-fallback

Conversation

@atishay-kasliwal

Copy link
Copy Markdown

Checklist

  • I've read and agree to the project's contribution guidelines.
  • I'm requesting to pull a topic/feature/bugfix branch.
  • I checked that my code additions will pass code linting checks and unit tests.
  • I updated unit and integration tests (if applicable).
  • I added an [Unreleased] changelog entry for a user-visible change, or confirmed the change is exempt.
  • I'm ready to notify the team of this contribution.

Description

An all-decimal path segment longer than Python's integer-string conversion limit passes the isdecimal() check from #76, then raises ValueError from int(). The exception skips both the <path> marker and default(...).

_lookup_path now gets the index from a small _parse_index helper, which returns None for a segment that isn't a usable index, including one int() refuses. That takes the existing unresolved path, so the marker and default(...) work as they do for any other missing segment. The conversion limit itself isn't touched.

Tests cover input and config, with and without a default, on lists and tuples, plus normal indices and a Unicode decimal digit. The oversized index is max(sys.get_int_max_str_digits(), 4300) + 1 digits long, so the test holds under any configured limit. With the limit disabled the index converts and is out of range, which gives the same result.

Verified with uv run pytest (538 passed), ruff check, ruff format --check and mypy src/. tests/test_resolving.py also passes with PYTHONINTMAXSTRDIGITS=640 and =0. Reverting the resolving.py change makes the new list and tuple cases fail.

Fixes #91

An all-decimal segment longer than Python's integer-string conversion
limit passed the isdecimal() check and then raised ValueError from
int(), bypassing both the <path> marker and default(...).

Fixes intuit#91

Signed-off-by: Atishay Kasliwal <katishay@gmail.com>

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.

bug: oversized numeric placeholder indices raise instead of using the missing-value fallback

1 participant