Repository navigation
Ignore quoted percent and per-mille scaling symbols - #1370
Draft
vhinayindia wants to merge 1 commit into
Draft
vhinayindia wants to merge 1 commit into
vhinayindia wants to merge 1 commit into
Conversation
This branch has not been deployed
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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 aliteral 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
tzdatapackage:tests/test_numbers.py: 190 passed.Both baseline and patched full-suite runs used
TZ=UTCto avoid the existingnon-UTC
get_timezone_name(None)test failures. The original suite passed7,831 tests under the same conditions. Both runs retained the existing pytest
deprecation warning about generator-based parametrization in the TOML tests.