Skip to content

Commit 7b79c09

Browse files
authored
pystr.rs isdecimal() checks not only ASCII but also Unicode decimals
1 parent 0fe8a06 commit 7b79c09

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

Lib/test/test_unicode.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -661,8 +661,6 @@ def test_isascii(self):
661661
self.assertFalse("\u20ac".isascii())
662662
self.assertFalse("\U0010ffff".isascii())
663663

664-
# TODO: RUSTPYTHON
665-
@unittest.expectedFailure
666664
def test_isdecimal(self):
667665
self.checkequalnofix(False, '', 'isdecimal')
668666
self.checkequalnofix(False, 'a', 'isdecimal')

vm/src/builtins/pystr.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -709,7 +709,8 @@ impl PyStr {
709709

710710
#[pymethod]
711711
fn isdecimal(&self) -> bool {
712-
!self.bytes.is_empty() && self.char_all(|c| c.is_ascii_digit())
712+
!self.bytes.is_empty()
713+
&& self.char_all(|c| GeneralCategory::of(c) == GeneralCategory::DecimalNumber)
713714
}
714715

715716
#[pymethod(name = "__mod__")]

0 commit comments

Comments
 (0)