⚡ Sangsakala Proxy 🏠 Home
Skip to content

Align Linux locale collation with Python 3.15 - #9674

Draft
youknowdot wants to merge 1 commit into
RustPython:mainfrom
youknowdot:locale-wide-collation-group-20261103
Draft

youknowdot wants to merge 1 commit into
RustPython:mainfrom
youknowdot:locale-wide-collation-group-20261103

Conversation

@youknowdot

Copy link
Copy Markdown
Contributor

Summary

  • Route Linux _locale.strcoll and strxfrm through wide-character collation, retaining lone surrogates and rejecting embedded NULs through a shared converter after normal argument binding.
  • Encode transformation weights with CPython 3.15's exact > 0x10000 boundary; preserve individual surrogate weights and propagate libc errors separately from allocation failures.
  • Bound the second-pass result by the allocated buffer. Existing host APIs and non-Linux routes remain unchanged.

The current narrow UTF-8 route reverses comparisons in non-UTF-8 locales. In installed sv_SE, comparing z with ä returns positive through the current narrow call but negative through CPython's wide call. Reference probes found 24/100 ordering differences in each of en_US and de_DE, and 36/100 in sv_SE.

Reference: CPython 3.15 collation implementation.

Validation

  • Fresh package-clean cargo check for host_env, vm and stdlib, with rustpython-stdlib/threading, locked/offline, one job.
  • Strict Clippy for the same three packages and feature selection (-D warnings).
  • Bounded CPython 3.15 reference probes: 78 raw-wide-key comparisons and 1,014 pair-order comparisons across six installed locales; additional non-UTF-8 ordering probes, surrogate/boundary cases, NUL/type precedence and subclass callbacks.
  • rustfmt, diff check and normal pre-commit hooks.

Native RustPython execution, full suites and other platforms were not run. No tests, standard-library Python files or workflows are changed. No >Unicode raw weights or invalid-UTF-8 narrow keys were observed; allocation-failure and concurrent-size-change branches were source-reviewed, not fault-injected.

AI assistance

Implementation, source review and validation were AI-assisted using OpenAI Codex (model version not exposed).

Use wide collation strings, retain surrogate code points, encode transform weights in Python 3.15 order, and preserve errno and allocation failures.

AI-assisted implementation, source review, and validation using OpenAI Codex.

Assisted-by: OpenAI Codex:model version not exposed
@coderabbitai

coderabbitai Bot commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

Share

@codspeed

codspeed Bot commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

✅ 62 untouched benchmarks
⏩ 4 skipped benchmarks1


Comparing youknowdot:locale-wide-collation-group-20261103 (00c4058) with main (0b081b0)

Open in CodSpeed

Footnotes

  1. 4 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant