Skip to content

Reject invalid numeric literals and support MinInt64 - #27

Closed
qoke wants to merge 2 commits into
ardanlabs:mainfrom
iqhive:jinjafix-numeric-literal-overflow
Closed

qoke wants to merge 2 commits into
ardanlabs:mainfrom
iqhive:jinjafix-numeric-literal-overflow

Conversation

@qoke

@qoke qoke commented Oct 22, 2026

Copy link
Copy Markdown

Closes #20.

Numeric parsing was discarding conversion errors, allowing malformed or out-of-range literals to produce incorrect values. Integer and floating-point conversion failures now stop compilation.

The minimum signed 64-bit integer needs separate handling. -9223372036854775808 is valid, but its positive magnitude cannot be parsed as a signed 64-bit integer. Unary-minus parsing now recognises that boundary before attempting the conversion.

Integers outside the supported range are rejected. That remains an intentional difference from Python’s arbitrary-precision integer support.

Regression coverage includes malformed exponent syntax, an oversized integer, and the valid minimum integer, with reference results and the original Go failures. The oversized-integer case documents the Python-parity exception, and all regression expectations pass with the fix.

@ardan-bkennedy

Copy link
Copy Markdown
Contributor

Thank you, @qoke, for reporting these issues and for providing proposed fixes. We reviewed all nine reports and used your suggestions where they made sense in the codebase. All nine issues have now been resolved in #34, each with corresponding regression tests, and the fixes are published in v1.11.0.

The issue addressed by this PR (#20) is covered by that release, so we are closing this PR in favor of the consolidated fix.

For future reports, please start with issues only so we can discuss the approach before opening pull requests. Thanks again for helping improve the project.

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.

Reject invalid numeric literals and support the minimum signed integer

2 participants