Repository navigation
Preserve Unicode casefold keys when IGNORECASE and LOWERCASEFIRST are combined - #211
Open
rupayon123 wants to merge 1 commit into
Open
rupayon123 wants to merge 1 commit into
rupayon123 wants to merge 1 commit into
Conversation
agammann
approved these changes
Nov 1, 2026
agammann
left a comment
There was a problem hiding this comment.
I reviewed the case-transform branch at ac19fa6. With IGNORECASE set, applying casefold directly prevents LOWERCASEFIRST and the internal locale swap from changing Unicode comparison keys. The focused transform, key, and sorting tests pass locally (43 tests on Python 3.14.8), including dotless i and long s across PATH and normalization modes. I did not run the full platform or optional PyICU matrix.
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.
LOWERCASEFIRSTis documented as having no effect withIGNORECASE, but the combination currently changes Unicode keys. For example, dotlessıis swapped toIand then casefolded toi, making it compare equal to ASCIIiand changing the sorted order.Apply casefold directly when
IGNORECASEis set; keep case swapping in the case-sensitive branch. Public regressions cover dotless i, long s, ASCII, forward/reverse ordering, paths and compatibility normalization. The internal transform expectation is updated to match the documented contract.On macOS arm64/Python 3.12.15, all 389 tests pass with both the pure Python and fastnumbers 5.2.0 backends. Doctests, strict mypy, formatting, package builds and twine checks pass. Ruff 0.17.3 reports the same 39 existing diagnostics on unchanged main and this patch, with none introduced. Other Python/OS combinations and PyICU were not run locally.