Repository navigation
Fix string casing against the pinned Unicode database - #9824
Merged
youknowone merged 1 commit intoNov 13, 2026
Merged
Conversation
Generate compact full-case tables from ICU rather than using the Rust compiler Unicode version. Preserve full mappings, contextual sigma and lone surrogates without repeated runtime ICU mapping overhead. Assisted-by: dot (OpenAI Codex; model version unavailable)
Contributor
|
Caution Review failedThe pull request is closed.
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
Member
|
@joshuamegnauth54 could you review this patch? |
youknowone
marked this pull request as ready for review
November 13, 2026 06:39
Codex Review Summary: ❌ FailedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
youknowone
approved these changes
Nov 13, 2026
This was referenced Nov 13, 2026
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.
Summary
Use the project's pinned ICU Unicode data consistently for
str.lower,str.upper,str.istitle, and the lowercase/uppercase portions of capitalize, title and swapcase. Preserve the ASCII VM fast paths and WTF-8 surrogate handling.Rust 1.100 ships Unicode 18 data, while CPython 3.15 and our Unicode database use Unicode 17. Mixing Rust's
char/strcase operations with ICU predicates makestest_unicodedata.UnicodeMethodsTest.test_method_checksumfail on main, independently of #9816 and #9820. For example,'\u0277'.upper()must remain unchanged with Unicode 17, but Rust's newer tables map it to U+A7DD.The existing Unicode build script generates compact full-mapping and contextual-property tables from ICU. Runtime casing uses immutable table lookups, including one-to-many mappings, and CPython's
lower_ucs4final-sigma context rules. Lone surrogates remain context boundaries. There is no runtime cache or toolchain-version exception, and no Lib test expectations change.A direct ICU runtime implementation was rejected after release benchmarks showed substantial Latin-text overhead. The generated-table implementation retains an ASCII-prefix path and statically dispatched character output. The tiny table/output helpers are inlined to avoid the measured call overhead.
CPython reference: Objects/unicodeobject.c, v3.15.0 (
lower_ucs4,do_upper_or_lower,do_swapcase,unicode_istitle_impl).Validation
a6f9fa98bde3bc2c24ab040ad9fe67b073971bbeversus8b2615a9fc627676cbc0b6fac0191177df97ef5f.9f6a743plus this change. All 0x110000 code points matched CPython 3.15.2 for lower/upper/title/capitalize/swapcase/casefold/istitle, with additional sigma, case-ignorable and surrogate-context cases.-m test test_unicodedata test_str: 212 tests passed, 19 skipped.cargo clippy -p rustpython-unicode --all-targets -- -D warnings: passed.call_between_rust_and_pythonexample (ldBus error), before aggregate tests ran. This is not recorded as a passing local aggregate run; the subsequent hosted runs below provide aggregate coverage.--all-targets, excluding wasm/venvlauncher/capi,-D warnings): passed. Separate CAPI strict Clippy (--all-targets -- -D warnings): passed.2012fb1b53d5205b806d5098a83adfb6db977a23: native Rust and Python tests on Ubuntu/macOS/Windows, WASI Python tests, WASM package, Miri, lint and remaining scheduled checks passed. Ubuntu CAPI build/tests/doctests steps were individually verified as successful. Conditional matrix/parity jobs were skipped by the workflow.AI-assisted implementation and verification with OpenAI Codex, with independent source review. Exact model version is not exposed in this environment.