Conversation
|
@Voyagerroc-Lab There's no need to use AI to summarise the original PR description. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #404 +/- ##
=======================================
Coverage 99.69% 99.70%
=======================================
Files 12 12
Lines 996 1011 +15
=======================================
+ Hits 993 1008 +15
Misses 3 3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Confirmed, and the asymmetry is the convincing part — the same finite value formats correctly or not depending only on whether you hand it over as an >>> big = 10**400 + 123
>>> intcomma(big) # '10,000,...,123'
>>> intcomma(str(big)) # '+Inf'Calling I diffed the full behaviour against
Leaving
Worth flagging across PRs: this is the same root pattern as #414, which fixes |
intcomma(str(10**400 + 123))currently returns"+Inf", although the same finite value passed as an integer is formatted correctly. The string path checksfloat(value)before attempting integer parsing, so values beyond the floating-point range are mistaken for infinity.With the default precision, parse integer strings with
int()first, after normalizing the locale's separators. Inputs that are not integer strings continue through the existing float/non-finite handling. This extends the default-precision behavior fixed for integer inputs in #392 to plain and already-grouped integer strings.The regression tests cover both signs, preserve the final
123, and check German and French grouping. Compatibility cases retain the existing handling of decimal strings, exponent strings, invalid input, and non-finite values. The existing float check is retained whenndigitsis explicitly set, with controls for both signs beyond the float range.Validation on Windows with Python 3.12:
git diff --checkpasses.