Repository navigation
Implement Unicode 17 grapheme iteration and properties - #9145
Conversation
|
Note Currently processing new changes in this PR. This may take a few minutes, please wait... ⚙️ Run configuration
⛔ Files ignored due to path filters: 1
📒 Files selected for processing: 7
✨ Finishing Touches
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. Comment |
📦 Library DependenciesThe following Lib/ modules were modified. Here are their dependencies: :4: SyntaxWarning: invalid decimal literal dependencies: dependent tests: (no tests depend on unicode) Legend:
|
Add the CPython extended grapheme state machine, full-codepoint properties, and traced Segment/iterator types with positional index handling. Refresh canonical unicodedata tests through update_lib while retaining pending markers. Include a losslessly range-compressed exact-final property oracle and differential test. Source-reviewed implementation; candidate runtime validation remains pending. Reference property generation completed against the pinned CPython Unicode extension. Assisted-by: OpenAI Codex:model version unavailable
Use the required Py<Segment> receiver for native descriptors; preserve payload ownership and representation behavior. Assisted-by: OpenAI Codex:model version unavailable
Keep the inherent impl on the local payload and receive &Py<Self>, as required for stdlib classes outside the VM crate. Assisted-by: OpenAI Codex:model version unavailable
Satisfy strict Clippy for the three pure property functions without changing their behavior. Assisted-by: OpenAI Codex:model version unavailable
Remove seven stale expected-failure markers through update_lib metadata after native property parity, canonical methods, full Unicode 17 grapheme corpus, and reference-cycle GC validation. Assisted-by: OpenAI Codex:model version unavailable
Compare the complete provenance line without its line ending so the same exact Unicode 17 reference is accepted after Windows checkout conversion. Keep the complete code-point property sweep unchanged. Assisted-by: OpenAI Codex:model version unavailable
Move the existing complete Unicode 17 property regression into the existing cfg(test) module to satisfy strict Clippy. Preserve the fixture, assertions, code-point coverage, and platform-independent provenance line check unchanged. Assisted-by: OpenAI Codex:model version unavailable
Assisted-by: OpenAI Codex:model version unavailable
Use the canonical code module path introduced in PyO3 0.30 without suppressing deprecation warnings. Assisted-by: OpenAI Codex:model version unavailable
5582424 to
07e76cd
Compare
Reuse the exact eight-file RustPython#9145 head 07e76cd delta, including the shared benchmark PyCodeInput repair once. Preserve optional Unicode 3.2 support. Replay canonical final unicodedata tests through actual update_lib with the reviewed seven retired guard targets; no manual Lib patch. The complete delta is byte-identical to the reviewed source branch; its recorded native/full-domain validation is retained. This checkpoint still requires integrated RustPython behavior validation. The source branch and PR remain unchanged. Assisted-by: OpenAI Codex:model version unavailable
Codex Review SummaryThis 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. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 07e76cd2ee
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| #[pyfunction] | ||
| fn grapheme_cluster_break(chr: PyStrRef, vm: &VirtualMachine) -> PyResult<&'static str> { |
There was a problem hiding this comment.
Expose the grapheme APIs on UCD instances
With the default ucd_3_2_0 feature enabled, these APIs are registered only as module-level #[pyfunction]s; no corresponding methods are added to Ucd. Unicode_3_2_0_FunctionsTest sets db = unicodedata.ucd_3_2_0 and inherits the four newly unmarked tests from BaseUnicodeFunctionsTest, so those tests now raise AttributeError when they access self.db.grapheme_cluster_break, the other properties, or iter_graphemes, making the standard test_unicodedata suite fail and leaving the CPython UCD API incomplete. Add the methods to Ucd or retain expected-failure markers until they work.
AGENTS.md reference: AGENTS.md:L279-L282
Useful? React with 👍 / 👎.
Summary
Implement the Unicode 17 grapheme prerequisite for #8954 as a standalone native feature with its canonical tests.
unicodedata.iter_graphemes(),grapheme_cluster_break(),indic_conjunct_break(), andextended_pictographic().__index__conversion/overflow, lone surrogates, subclass ownership, and streaming boundary state.Segmentand iterator types with traced references to the original string.test_unicodedata.pythrough the actualupdate_libtool and remove seven stale expected-failure markers only after validation. Preserve unrelated markers.Reference: CPython final
d220409a13b77de7a6c30abe16ea90db01528edc.This does not import the remaining traceback/theme/lazy-import consumers or expand legacy Unicode 3.2 behavior. No updater implementation, validation receipts, or new snippets are included.
Validation
Local Linux validation with Rust 1.99.0:
rustpython-unicode'sdifferentialtarget, then exactlyunicode17_grapheme_properties_exact_final: 1 passed. All 1,114,112 code points, including surrogates, matched all three reference properties without a version-skew allowance.threading,stdlib,stdio,importlib,host_env.-D warnings.e2d134d2c52919bace503ebb6a551c1855fe1a1faec18478c78fff254a1793ec.GraphemeBreakTest.test_reference_loops: passed, covering the iterator/string and Segment/string cycles.Python checks used fresh private processes, verified cache-free library inventories and native origins, 1 GiB address-space limits, 20-second CPU/30-second wall limits, and 64 KiB combined output caps. The corpus was supplied locally; no test helper fetched data during execution.
The native binary was built at
df5d20c073cc817ac8dfaa447e33e4883f6096e8; finalf50958f43366a9f6ec2173f29410a83503acdfc2changes only the seven test-marker lines. Native sources and Cargo inputs are identical, and post-marker validation records that library-only delta explicitly.These are targeted results, not a full workspace test run, general memory-safety proof, or platform-complete validation. Normal commit hooks passed.
AI assistance is disclosed in the commit trailers.