Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Tidy shared unicode review feedback
Agent-Logs-Url: https://github.com/RustPython/RustPython/sessions/e4115dbc-b1a5-4a77-90a7-38cf9ac1cdf2

Co-authored-by: youknowone <69878+youknowone@users.noreply.github.com>
  • Loading branch information
Copilot and youknowone authored Apr 5, 2026
commit e968d838082a3655b4f9c29192535d07325ae120
13 changes: 2 additions & 11 deletions crates/sre_engine/src/string.rs
Original file line number Diff line number Diff line change
Expand Up @@ -345,13 +345,8 @@ pub(crate) fn is_digit(ch: u32) -> bool {
rustpython_unicode::regex::is_digit(ch)
}
#[inline]
pub(crate) fn is_loc_alnum(ch: u32) -> bool {
// FIXME: Ignore the locales
rustpython_unicode::regex::is_locale_alnum(ch)
}
#[inline]
pub(crate) fn is_loc_word(ch: u32) -> bool {
ch == '_' as u32 || is_loc_alnum(ch)
rustpython_unicode::regex::is_locale_word(ch)
}
#[inline]
pub(crate) const fn is_linebreak(ch: u32) -> bool {
Expand Down Expand Up @@ -384,12 +379,8 @@ pub(crate) const fn is_uni_linebreak(ch: u32) -> bool {
rustpython_unicode::regex::is_unicode_linebreak(ch)
}
#[inline]
pub(crate) fn is_uni_alnum(ch: u32) -> bool {
rustpython_unicode::regex::is_unicode_alnum(ch)
}
#[inline]
pub(crate) fn is_uni_word(ch: u32) -> bool {
ch == '_' as u32 || is_uni_alnum(ch)
rustpython_unicode::regex::is_unicode_word(ch)
}
#[inline]
pub fn lower_unicode(ch: u32) -> u32 {
Expand Down
2 changes: 2 additions & 0 deletions crates/unicode/src/classify.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,12 @@ pub fn is_space(cp: u32) -> bool {
})
}

/// Python's `str.isprintable()` semantics, which treat ASCII space as printable.
pub fn is_printable(cp: u32) -> bool {
cp == '\u{0020}' as u32 || is_repr_printable(cp)
}

/// Repr/escape printable semantics, which exclude all Unicode space separators.
pub fn is_repr_printable(cp: u32) -> bool {
!matches!(
general_category(cp),
Expand Down
Loading