The LDML special-pattern-character rules
specify that quoting removes a character's special meaning. Remove complete
quoted spans from each affix before detecting scaling symbols, retaining the
existing percent precedence and behavior for unmatched apostrophes.
The regressions cover decimal and percent formatting, prefixes and suffixes,
positive and negative values, explicit negative subpatterns, mixed literal and
active symbols, scientific/significant-digit patterns, and apostrophe handling.
The separate existing rendering issue that drops doubled apostrophes inside a
quoted span is unchanged; those cases are checked at the scale level here.
Validation on Python 3.12.14 with the project's checksum-verified CLDR 48.2 data
and the tzdata package:
Final new cases on unchanged master: 35 failed, 24 passed.
Patched tests/test_numbers.py: 190 passed.
Full patched suite: 7,890 passed, 7 skipped, 2 xfailed.
All applicable pinned pre-commit hooks passed.
Source distribution and wheel built successfully.
Both baseline and patched full-suite runs used TZ=UTC to avoid the existing
non-UTC get_timezone_name(None) test failures. The original suite passed
7,831 tests under the same conditions. Both runs retained the existing pytest
deprecation warning about generator-based parametrization in the TOML tests.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
NumberPattern.compute_scale() counts % and ‰ inside quoted affixes, so a
literal symbol can silently multiply the value being formatted:
The LDML special-pattern-character rules
specify that quoting removes a character's special meaning. Remove complete
quoted spans from each affix before detecting scaling symbols, retaining the
existing percent precedence and behavior for unmatched apostrophes.
The regressions cover decimal and percent formatting, prefixes and suffixes,
positive and negative values, explicit negative subpatterns, mixed literal and
active symbols, scientific/significant-digit patterns, and apostrophe handling.
The separate existing rendering issue that drops doubled apostrophes inside a
quoted span is unchanged; those cases are checked at the scale level here.
Validation on Python 3.12.14 with the project's checksum-verified CLDR 48.2 data
and the tzdata package:
Both baseline and patched full-suite runs used TZ=UTC to avoid the existing
non-UTC get_timezone_name(None) test failures. The original suite passed
7,831 tests under the same conditions. Both runs retained the existing pytest
deprecation warning about generator-based parametrization in the TOML tests.