35 Commits
Author SHA1 Message Date
youknowdot 64330b80b9 Implement Unicode 17 grapheme iteration and properties (#9145)
* Implement native Unicode 17 grapheme iteration

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

* Bind grapheme Segment methods to the Python object

Use the required Py<Segment> receiver for native descriptors; preserve payload ownership and representation behavior.

Assisted-by: OpenAI Codex:model version unavailable

* Use explicit object receivers for Segment descriptors

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

* Mark grapheme property lookups as must-use

Satisfy strict Clippy for the three pure property functions without changing their behavior.

Assisted-by: OpenAI Codex:model version unavailable

* Enable validated Unicode grapheme canonical tests

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

* Accept platform line endings in grapheme oracle header

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

* Keep grapheme property regression in test module

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

* Qualify grapheme iterator return type for generated bindings

Assisted-by: OpenAI Codex:model version unavailable

* Fix deprecated PyO3 code input import in benchmarks

Use the canonical code module path introduced in PyO3 0.30 without suppressing deprecation warnings.

Assisted-by: OpenAI Codex:model version unavailable
2026-10-16 23:40:26 +09:00
Joshua Megnauth c8f1ab7fbc ucd: Parse Unihan data for 3.2.0; unmask numeric test (#8783)
* ucd: Parse Unihan data for 3.2.0; unmask test

Python's 3.2.0 path uses the Unihan data for supplementary numeric
values. The Unihan data isn't bundled with the "full" data which means
we have to parse it ourselves. The full data is large, so I compressed
it with zlib.

AI disclosure: I asked an LLM to elaborate on why the full Unicode 3.2.0
data precludes \u5793. It explained that the code point is part of
Unihan. I wrote the parser myself. I linted the zlib snippet with AI.

Assisted-by: GPT-5.6: Luna

* Use spare_capacity_mut + set_len over transmute
2026-09-25 08:21:25 +09:00
Joshua Megnauth 3442228b59 unicodedata: Fix name, unmask test_name (#8599)
This commit fixes most of UCD's names. The two main fixes are:

* Handling chars missing in 3.2.0 by checking for membership #8548
* Handling names not present in unicodenames

AI disclosure: I used AI for the initial research of this patch to
determine why the Tangut characters are missing. AI also assisted with a
bug fix where I neglected to parse the Tangut u32 as hex. I wrote all of
the code.

Assisted-by: GPT 5.6 Luna
2026-09-05 01:25:48 +09:00
Joshua Megnauth 895be40542 Update test_unicodedata to 3.15 (#8598)
See: #8548
2026-08-26 22:34:32 +09:00
Joshua Megnauth 9b6feb5132 unicodedata: Fix Bidirectional, improve parser (#8548)
We can save space by calculating the diffs between modern Unicode and
3.2.0 and storing membership information where valid. This avoids
storing entire tables for 3.2.0, and is also more correct in the long
run since it handles absence from 3.2.0 correctly. I switched over Bidi
to this new method which partially fixed the test. Unfortunately, our
Unicode data is more up to date than Python 3.14 so the test fails for
modern Unicode. I updated the test to 3.15 as per review, and now our
bidi passes the test.
2026-08-24 17:51:53 +09:00
Joshua Megnauth 5c1803e019 Fix most of unicodedata; unmask multiple tests (#7947) 2026-06-14 17:47:42 +09:00
Shahar Naveh b1df45bd09 Update test_unicodedata.py to 3.14.4 (#7750)
* Update `test_unicodedata.py` to 3.14.4

* Add test asset

* Mark failing tests

* Add `expectedSuccess` docorator

* Add support for nee decorator in patch_spec

* Reapply patches
2026-05-01 19:48:41 +09:00
Changjoon c0005f744b Apply titlecase mapping in str.title() for uppercase digraphs (#7748)
The uppercase/titlecase branch of PyStr::title() pushed characters
unchanged when starting a new word, which left Latin Extended-B
digraphs (U+01F1 'DZ', U+01C4 'DŽ', etc.) in their uppercase form
instead of mapping them to their distinct titlecase counterparts
(U+01F2 'Dz', U+01C5 'Dž'). For ASCII letters and characters where
to_titlecase is identity this had no effect, hiding the bug for the
common case.

Mirror the lowercase branch — which already calls to_titlecase()
when starting a new word — so both branches symmetrically apply
the titlecase mapping. char::to_titlecase is identity for already-
titlecase and ASCII-uppercase characters, so existing cases stay
correct.

Also unmasks test_unicodedata.UnicodeMiscTest.test_bug_4971, which
asserts exactly this behavior (`'DŽ'.title() == 'Dž'` etc.)
and was marked expectedFailure with reason `+ Dž`.

Closes #7527 (the only example from that issue still failing on
3.14.4; the other four examples already pass on current main).
2026-05-01 19:45:55 +09:00
Shahar Naveh c857db6e9e Replace unmaintained unic crates (#7555) 2026-04-03 01:43:11 +09:00
Jeong, YunWon 8d098ef4d1 Implement missing unicodedata functions and fix lookup error type
Add combining, decomposition, digit, decimal, numeric methods to Ucd.
Change lookup() to raise KeyError instead of LookupError.
Remove expectedFailure markers from 9 passing tests.
Add unicodedata.is_normalized() method.
Rename decomp_chars to chars to fix spell check.
Remove expectedFailure from test_named_unicode_escapes and
test_urlsplit_normalization.
2026-02-14 09:32:17 +09:00
CPython Developers 4f24a889bd Update test_unicodedata from v3.14.2 2026-02-14 09:32:04 +09:00
ShaharNaveh d28164c150 Update test_ucn.py from 3.13.7 2025-08-24 00:17:50 +03:00
Shahar Naveh e75aebb967 Update str related tests from 3.13.5 (#5953)
* Update str related tests from 3.13.5

* Apply RustPython patches

* Mark new failing tests
2025-07-12 20:44:34 +09:00
Jeong YunWon 4cdb8d18b7 unicodedata.is_mirrored 2025-06-22 21:32:12 +09:00
Noa a86126419c Fix remaining tests 2025-03-25 19:05:12 -05:00
LYK b687960c5d Mark failing tests of test_unitcodedata 2023-03-10 17:01:47 +09:00
LYK 134f62a776 Update test_unicodedata from CPython 3.11.2 2023-03-10 04:06:03 +09:00
Zhiyan Xiao 3b8d670c81 Add unicodedata.east_asian_width (#4523) 2023-02-20 01:38:02 +09:00
Padraic Fanning d50735d8f4 Unskip tests in test_unicodedata 2021-02-25 23:16:13 -05:00
Padraic Fanning 1e300dceb3 Explain test_bug_5828 skip 2021-02-08 21:03:06 -05:00
Padraic Fanning 625ac78de3 Explain test_ucd_510 skip 2021-02-08 21:01:39 -05:00
Padraic Fanning 194db04ef1 Explain test_digit_numeric_consistent skip 2021-02-08 21:01:00 -05:00
Padraic Fanning e6dd77767d Explain test_decimal_numeric_consistent skip 2021-02-08 21:00:18 -05:00
Padraic Fanning 2827f3e243 Explain test_east_asian_width_9_0_changes skip 2021-02-08 20:58:55 -05:00
Padraic Fanning 474cacaec6 Explain test_east_asian_width skip 2021-02-08 20:58:22 -05:00
Padraic Fanning 6d215bf03d Explain test_combining skip 2021-02-08 20:56:40 -05:00
Padraic Fanning 9ba770c28e Explain test_mirrored skip 2021-02-08 20:56:00 -05:00
Padraic Fanning 006a2f0728 Explain test_decomposition skip 2021-02-08 20:53:29 -05:00
Padraic Fanning 7d8cbd559c Explain test_decimal skip 2021-02-08 20:52:51 -05:00
Padraic Fanning 76d5086327 Explain test_numeric skip 2021-02-08 20:50:04 -05:00
Padraic Fanning 04a1cd44b4 Explain test_digit skip 2021-02-08 20:49:26 -05:00
Padraic Fanning 9eb81d16c1 Explain test_function_checksum skip 2021-02-08 20:48:41 -05:00
Padraic Fanning effdfc5a5d Explain test_method_checksum skip 2021-02-08 20:47:20 -05:00
Robert Booth dbc3d64507 remaining test_unicode* from v3.8.7 2021-01-27 12:59:11 +09:00
Robert Booth fd6e44afdf remaining test_unicode* from v3.8.7 2021-01-27 11:48:31 +09:00