Repository navigation
Increment long numeric prerelease and build identifiers without integer conversion - #496
machines-6657 wants to merge 1 commit into
Conversation
|
Thank you @machines-6657 for the contribution. The string-based digit comparison and increment logic ( In regards to the 5,000 digit, this scenario is unrealistic:
In line with the SemVer FAQ and general defense-in-depth against resource abuse, I'd like to enforce a sensible upper bound of 512 characters on version strings via Could you adjust the tests so that:
That gives us both the efficiency of your string-based algorithm and a clean guard against excessively large inputs. |
Summary
Version.parse()accepts a valid 5000-digit numeric prerelease or buildidentifier, but
bump_prerelease()andbump_build()raiseValueErrorunderPython's default integer-string conversion limit. Increment ASCII decimal
strings directly rather than converting them to integers.
Preserve existing constructor normalization of prerelease leading zeros,
build padding, Unicode digit handling and input immutability. The process-wide
integer conversion limit is left unchanged.
Validation
100% statement and branch coverage.
Ruff results remain at the same 160 inherited findings; no added occurrences.
Upstream marks that check nonblocking. Configured mypy still reports the
optional backend's missing typing information; docformatter still reports
existing formatting differences. Neither is claimed to pass.
matrices have not been run. A numbered newsfragment is deferred until a PR
number exists, following the project's post-PR changelog instructions.
AI assistance disclosure: OpenAI Codex assisted with investigation,
implementation, regressions and independent baseline verification under the
contributor's authorization.