◐ Shell
clean mode source ↗

fix: Handle char expansion in islower, isupper by joshuamegnauth54 · Pull Request #7583 · RustPython/RustPython

coderabbitai[bot]

Bot reviewed Apr 12, 2026

Closes: RustPython#7526

`py_islower` and `py_isupper` need to handle expansions for letter
casing. Comparing chars directly can miss edge cases in certain
languages. Unfortunately, like the last PR, this allocates to handle
potential expansions.

I also had to add `icu_casemap` as a dependency.
RustPython is already using parts of icu4x so this doesn't add many
transitive dependencies.

coderabbitai[bot]

This fixes a regression mentioned by CodeRabbit. I also figured out how
to check a string's case without allocation using Unicode properties.
Thus, this commit removes `icu_casemap` again. `icu_casemap` and my old
solution is required for a robust case check, but it seems like the
current code is fine for Python.

ShaharNaveh

ShaharNaveh

youknowone

This was referenced

May 1, 2026