@@ -605,6 +605,27 @@ def test_bug_817234(self):
605605 self .assertEqual (next (iter ).span (), (4 , 4 ))
606606 self .assertRaises (StopIteration , next , iter )
607607
608+ def test_bug_6561 (self ):
609+ # '\d' should match characters in Unicode category 'Nd'
610+ # (Number, Decimal Digit), but not those in 'Nl' (Number,
611+ # Letter) or 'No' (Number, Other).
612+ decimal_digits = [
613+ '\u0037 ' , # '\N{DIGIT SEVEN}', category 'Nd'
614+ '\u0e58 ' , # '\N{THAI DIGIT SIX}', category 'Nd'
615+ '\uff10 ' , # '\N{FULLWIDTH DIGIT ZERO}', category 'Nd'
616+ ]
617+ for x in decimal_digits :
618+ self .assertEqual (re .match ('^\d$' , x ).group (0 ), x )
619+
620+ not_decimal_digits = [
621+ '\u2165 ' , # '\N{ROMAN NUMERAL SIX}', category 'Nl'
622+ '\u3039 ' , # '\N{HANGZHOU NUMERAL TWENTY}', category 'Nl'
623+ '\u2082 ' , # '\N{SUBSCRIPT TWO}', category 'No'
624+ '\u32b4 ' , # '\N{CIRCLED NUMBER THIRTY NINE}', category 'No'
625+ ]
626+ for x in not_decimal_digits :
627+ self .assertIsNone (re .match ('^\d$' , x ))
628+
608629 def test_empty_array (self ):
609630 # SF buf 1647541
610631 import array
0 commit comments