Skip to content

Correct error messages for out-of-range Meta length bounds - #1172

Merged
Siyet merged 1 commit into
mainfrom
meta-bounds-overflow
Sep 13, 2026
Merged

Siyet merged 1 commit into
mainfrom
meta-bounds-overflow

Conversation

@Siyet

@Siyet Siyet commented Sep 8, 2026 •

Copy link
Copy Markdown
Contributor

Calling Meta(min_length=10**400) results in a ValueError with the incorrect message "must be >= 0" for a positive integer. With this fix, out-of-range min_length and max_length values result in an error identifying the range issue. Accepted values and diagnostics for representable negative values are unchanged.

This is the length-bound fix discussed in #1122, separate from the numeric constraints work in #1006.

@codspeed

codspeed Bot commented Sep 8, 2026

Copy link
Copy Markdown

Merging this PR will degrade performance by 10.31%

❌ 1 regressed benchmark
✅ 138 untouched benchmarks
⏩ 135 skipped benchmarks1

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Mode Benchmark BASE HEAD Efficiency
❌ Simulation test_pickle_load[arm] 1.6 ms 1.8 ms -10.31%

Tip

Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.


Comparing meta-bounds-overflow (ededd5b) with main (3f67b34)

Open in CodSpeed

Footnotes

  1. 135 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

@Siyet

Siyet commented Sep 8, 2026 •

Copy link
Copy Markdown
Contributor Author

The CodSpeed result for test_pickle_load[arm] is 1.6 ms on the baseline and 1.8 ms on this branch (-10.31%). These values match the two states documented in #1110. The changed helper is used only for length-bound validation in Meta.__new__ and is not called in this pickle workload.

In a local pyperf comparison of the same workload on macOS, the difference between main and the patched version was not statistically significant. This does not establish the cause of the Linux simulation result. I am leaving the PR open pending resolution of the CodSpeed check.

@Siyet Siyet changed the title Report out-of-range Meta length bounds accurately Correct error messages for out-of-range Meta length bounds Sep 8, 2026
@Siyet
Siyet force-pushed the meta-bounds-overflow branch from 2dadb61 to f3d3ba3 Compare September 13, 2026 08:50
@Siyet
Siyet added this pull request to the merge queue Sep 13, 2026
Merged via the queue into main with commit 5b556a0 Sep 13, 2026
24 checks passed
@Siyet
Siyet deleted the meta-bounds-overflow branch September 13, 2026 09:41
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