René's URL Explorer Experiment


Title: Complete rustpython-unicode isolation: case mapping, casing predicates, and sre case/space parity · Issue #8236 · RustPython/RustPython · GitHub

Open Graph Title: Complete rustpython-unicode isolation: case mapping, casing predicates, and sre case/space parity · Issue #8236 · RustPython/RustPython

X Title: Complete rustpython-unicode isolation: case mapping, casing predicates, and sre case/space parity · Issue #8236 · RustPython/RustPython

Description: Follow-up to #7560, continuing from #8211 (merged). Background #8211 extracted crates/unicode (rustpython-unicode) and routed the unicodedata database, str classification predicates, casefold, identifier predicates, \N{} name lookup, and...

Open Graph Description: Follow-up to #7560, continuing from #8211 (merged). Background #8211 extracted crates/unicode (rustpython-unicode) and routed the unicodedata database, str classification predicates, casefold, iden...

X Description: Follow-up to #7560, continuing from #8211 (merged). Background #8211 extracted crates/unicode (rustpython-unicode) and routed the unicodedata database, str classification predicates, casefold, iden...

Opengraph URL: https://github.com/RustPython/RustPython/issues/8236

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Complete rustpython-unicode isolation: case mapping, casing predicates, and sre case/space parity","articleBody":"Follow-up to #7560, continuing from #8211 (merged).\n\n## Background\n\n#8211 extracted `crates/unicode` (`rustpython-unicode`) and routed the\nunicodedata database, str classification predicates, casefold, identifier\npredicates, `\\N{}` name lookup, and the sre `\\d`/`\\w` tables through it.\n\nThe goal of #7560 — *one authoritative Unicode path*, usable outside the\nPython runtime — is not finished yet. Case conversion and casing predicates\nstill live inside `rustpython-vm` as direct icu4x calls, so any consumer\nother than the vm has to re-implement them (and will drift from CPython in\nexactly the ways the shared crate is meant to prevent: titlecase mappings\nfor `Lt` characters, final-sigma context, case-ignorable segmentation).\nThe sre engine also still carries two unverified case/space quirks marked\n`TODO: check with cpython`. This issue proposes the remaining work to make\nthe crate the single Unicode authority.\n\n## Current gaps (verified against main)\n\n### 1. Case conversion and casing predicates are vm-private\n\n`crates/vm` is the only crate besides `crates/unicode` that still depends on\n`icu_casemap` / `icu_locale` / `icu_properties` directly:\n\n- `vm/src/builtins/str.rs`:\n  - `title` / `capitalize` — `TitlecaseMapper::titlecase_segment` plus a\n    hand-written cased/case-ignorable segmentation loop\n    (`titlecase_string`, `titlecase_first`).\n  - `lower` (via `str::to_lowercase`), `capitalize`/`title`/`swapcase` —\n    context-sensitive final-sigma handling (`lowercase_or_sigma`,\n    `handle_capital_sigma` over `Cased` / `CaseIgnorable`).\n  - `istitle` — `GeneralCategoryGroup::TitlecaseLetter` +\n    `char::is_uppercase`/`is_lowercase`.\n- `vm/src/anystr.rs`:\n  - `is_cased\u003cVALID, INVALID\u003e` — the shared `islower`/`isupper` kernel,\n    generic over the icu `BinaryProperty` trait (`Lowercase` / `Uppercase`),\n    also consulting `TitlecaseLetter`.\n\nEverything above is Unicode *semantics* (context-sensitive case mapping,\nderived casing properties), not a string algorithm; per #7560's own\narchitecture (\"`crate::str` calls into rustpython-unicode for all\nUnicode-sensitive behavior\") it belongs in the shared crate. The crate's\n`case` module currently exposes only `casefold_str` / `casefold_wtf8`.\n\n### 2. sre_engine case/space helpers are unverified against CPython\n\n`crates/sre_engine/src/string.rs`:\n\n- `is_uni_space` — `SRE_UNI_IS_SPACE` is `Py_UNICODE_ISSPACE`, i.e. exactly\n  `classify::is_space`, but the current implementation is a hand-rolled BMP\n  `matches!` list marked `TODO: check with cpython`.\n- `lower_unicode` / `upper_unicode` — CPython's `sre_lower_unicode` /\n  `sre_upper_unicode` use the *simple* one-to-one mappings\n  (`Py_UNICODE_TOLOWER` / `TOUPPER`). The current implementation takes the\n  first character of the *full* mapping\n  (`to_lowercase().next()`), which diverges wherever a code point has a\n  full mapping but no simple one — e.g. `upper_unicode('ß')` returns `'S'`\n  while CPython keeps `'ß'` (U+00DF has no simple uppercase). Both are\n  marked `TODO: check with cpython`.\n\n## Proposal\n\n### A. Expand `unicode::case` (move, no behavior change)\n\nCode-point level:\n\n- `simple_lowercase` / `simple_uppercase` / `simple_titlecase` /\n  `simple_casefold` — direct wrappers over\n  `icu_casemap::CaseMapper`'s simple mappings (pure, borrowed compiled\n  data, no_std-clean). Needed by sre (B) and by any consumer implementing\n  per-code-point casing.\n- Casing predicates: `is_lowercase` (`Lowercase`), `is_uppercase`\n  (`Uppercase`), `is_titlecase` (`Lt`), `is_cased` (`Cased`),\n  `is_case_ignorable` (`Case_Ignorable`). These retire the icu\n  `BinaryProperty` generics in `vm/anystr.rs` and provide the\n  `islower`/`isupper`/`istitle` kernels.\n\nString level (`\u0026str` and `\u0026Wtf8`, following the `casefold_str` /\n`casefold_wtf8` precedent; lone surrogates pass through unchanged):\n\n- `lower_*` / `upper_*` — full mappings incl. final-sigma context.\n- `title_*` / `capitalize_*` / `swapcase_*` — move `titlecase_string`,\n  `titlecase_first`, `lowercase_or_sigma`, `handle_capital_sigma` from\n  `vm/builtins/str.rs` verbatim. The crate gains an `icu_locale` dependency\n  (root-locale `TitlecaseMapper`), which is no_std-compatible.\n\nThis is a pure relocation: byte-for-byte behavior, gated by `test_str`.\n\n### B. Fix sre_engine parity (behavior changes, separate commits)\n\n- `is_uni_space` → `classify::is_space`.\n- `lower_unicode` / `upper_unicode` → `case::simple_lowercase` /\n  `case::simple_uppercase`.\n- Each change is a documented CPython-correctness fix, verified by a full\n  scalar-range sweep (see Verification) — not folded into the move commit.\n\n### C. Drop icu from `rustpython-vm`\n\nAfter A, `vm/builtins/str.rs` and `vm/anystr.rs` consume `unicode::case`,\nand `icu_casemap` / `icu_locale` / `icu_properties` leave\n`crates/vm/Cargo.toml`. Acceptance: `crates/unicode` is the only workspace\nmember with a direct icu dependency.\n\n### D. (Optional) CodePoint-level convenience layer\n\n#7560 sketched a u32-first API; the crate today is `char`-first for\npredicates and `CodePoint`/`Wtf8` where non-scalars matter. If consumer\ncall sites show repeated `CodePoint -\u003e char` boilerplate, add thin\n`CodePoint` variants (predicates return `false`, mappings return identity\nfor lone surrogates). Decide from real usage, not up front.\n\n## Verification\n\n- Extend `crates/unicode/tests/differential.rs` and the committed reference\n  dataset with the new dimensions, reusing the existing version-skew\n  allow-list mechanism:\n  - casing predicates (`islower`-class, `isupper`-class, cased,\n    case-ignorable, `Lt`) swept over `0..0x110000`;\n  - simple case mappings swept against CPython — `_sre.getlower(ch, flags)`\n    covers the lowercase path directly; for upper/title, generate the\n    reference from the vendored `UnicodeData.txt` simple-mapping columns\n    and pin down CPython's exact table choice as part of the work.\n- Context-sensitive string-level behavior (final sigma, titlecase\n  segmentation) is covered by CPython's own `test_str` (`title`,\n  `capitalize`, `swapcase` cases) plus a small generated corpus if gaps\n  show up.\n- Regression gate unchanged: `test_unicodedata`, `test_str`, `test_re`,\n  `test_pkgutil`, `extra_tests/snippets/stdlib_unicode_shared.py` —\n  identical or better only. `cargo build -p rustpython-unicode --target\n  thumbv7em-none-eabi` stays green.\n\n## Out of scope\n\n- Python str object behavior and non-case string algorithms (unchanged\n  non-goals of #7560).\n- Locale-dependent casing (Turkish/Azeri dotted-I etc.) — CPython's `str`\n  does not perform it either; the root locale is the specified behavior.\n","author":{"url":"https://github.com/youknowone","@type":"Person","name":"youknowone"},"datePublished":"2026-07-08T04:18:11.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/8236/RustPython/issues/8236"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:20809884-f084-111d-3d99-9f2371c3bffb
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idD23A:257A7:2281AF7:326E60C:6A60D917
html-safe-nonce599695d33615288bf4297738ffe62b00d5af89e55335e9279b855239d331003c
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEMjNBOjI1N0E3OjIyODFBRjc6MzI2RTYwQzo2QTYwRDkxNyIsInZpc2l0b3JfaWQiOiI4MTk3ODY5NTI2MzcxNTg4Mzc1IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmacaa4a4dcf92b674df3d1bea94b1fd453476e0582c121e06290f2312846cf99ea0
hovercard-subject-tagissue:4834298944
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/RustPython/RustPython/8236/issue_layout
twitter:imagehttps://opengraph.githubassets.com/e0558a690b5ba607db1b496ef2eab0298602358cdc06b1b1c9abfd8cb2f12a73/RustPython/RustPython/issues/8236
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/e0558a690b5ba607db1b496ef2eab0298602358cdc06b1b1c9abfd8cb2f12a73/RustPython/RustPython/issues/8236
og:image:altFollow-up to #7560, continuing from #8211 (merged). Background #8211 extracted crates/unicode (rustpython-unicode) and routed the unicodedata database, str classification predicates, casefold, iden...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameyouknowone
hostnamegithub.com
expected-hostnamegithub.com
None025e511fb0e6dd11aaa36892212f7bcc13708244bc2bcbeff1cf34fc77723812
turbo-cache-controlno-preview
go-importgithub.com/RustPython/RustPython git https://github.com/RustPython/RustPython.git
octolytics-dimension-user_id39710557
octolytics-dimension-user_loginRustPython
octolytics-dimension-repository_id135201145
octolytics-dimension-repository_nwoRustPython/RustPython
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id135201145
octolytics-dimension-repository_network_root_nwoRustPython/RustPython
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release405b1f59618e9c5e102e2408c26ce58f1937fbca
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/RustPython/RustPython/issues/8236#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FRustPython%2FRustPython%2Fissues%2F8236
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub Copilot appDirect agents from issue to mergehttps://github.com/features/ai/github-app
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
Code QualityEnforce quality at mergehttps://github.com/features/code-quality
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
View all resourceshttps://github.com/resources
GitHub SponsorsFund open source developershttps://github.com/open-source/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/open-source/accelerator
GitHub Starshttps://stars.github.com
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FRustPython%2FRustPython%2Fissues%2F8236
Sign up https://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=RustPython%2FRustPython
Reloadhttps://github.com/RustPython/RustPython/issues/8236
Reloadhttps://github.com/RustPython/RustPython/issues/8236
Reloadhttps://github.com/RustPython/RustPython/issues/8236
Please reload this pagehttps://github.com/RustPython/RustPython/issues/8236
RustPython https://github.com/RustPython
RustPythonhttps://github.com/RustPython/RustPython
Notifications https://github.com/login?return_to=%2FRustPython%2FRustPython
Fork 1.5k https://github.com/login?return_to=%2FRustPython%2FRustPython
Star 22.2k https://github.com/login?return_to=%2FRustPython%2FRustPython
Code https://github.com/RustPython/RustPython
Issues 293 https://github.com/RustPython/RustPython/issues
Pull requests 102 https://github.com/RustPython/RustPython/pulls
Discussions https://github.com/RustPython/RustPython/discussions
Actions https://github.com/RustPython/RustPython/actions
Projects https://github.com/RustPython/RustPython/projects
Models https://github.com/RustPython/RustPython/models
Wiki https://github.com/RustPython/RustPython/wiki
Security and quality 0 https://github.com/RustPython/RustPython/security
Insights https://github.com/RustPython/RustPython/pulse
Code https://github.com/RustPython/RustPython
Issues https://github.com/RustPython/RustPython/issues
Pull requests https://github.com/RustPython/RustPython/pulls
Discussions https://github.com/RustPython/RustPython/discussions
Actions https://github.com/RustPython/RustPython/actions
Projects https://github.com/RustPython/RustPython/projects
Models https://github.com/RustPython/RustPython/models
Wiki https://github.com/RustPython/RustPython/wiki
Security and quality https://github.com/RustPython/RustPython/security
Insights https://github.com/RustPython/RustPython/pulse
#8237https://github.com/RustPython/RustPython/pull/8237
Complete rustpython-unicode isolation: case mapping, casing predicates, and sre case/space parityhttps://github.com/RustPython/RustPython/issues/8236#top
#8237https://github.com/RustPython/RustPython/pull/8237
https://github.com/youknowone
youknowonehttps://github.com/youknowone
on Jul 8, 2026https://github.com/RustPython/RustPython/issues/8236#issue-4834298944
#7560https://github.com/RustPython/RustPython/issues/7560
#8211https://github.com/RustPython/RustPython/pull/8211
#8211https://github.com/RustPython/RustPython/pull/8211
#7560https://github.com/RustPython/RustPython/issues/7560
#7560https://github.com/RustPython/RustPython/issues/7560
#7560https://github.com/RustPython/RustPython/issues/7560
rustpython-unicode #7560https://github.com/RustPython/RustPython/issues/7560
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.