Skip to content
Merged
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
"X"
  • Loading branch information
StanFromIreland committed Oct 29, 2025
commit 6fe1ab897535b52cee1d895fea9b0ee82246997c
4 changes: 2 additions & 2 deletions Doc/library/unicodedata.rst
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ following functions:
1


.. function:: isidstart(chr, /)
.. function:: isxidstart(chr, /)

Return ``True`` if *chr* is a valid identifier start per the
`Unicode Standard Annex #31 <https://www.unicode.org/reports/tr31/>`_,
Expand All @@ -159,7 +159,7 @@ following functions:
.. versionadded:: next


.. function:: isidcontinue(chr, /)
.. function:: isxidcontinue(chr, /)

Return ``True`` if *chr* is a valid identifier charcter per the
`Unicode Standard Annex #31 <https://www.unicode.org/reports/tr31/>`_,
Expand Down
52 changes: 26 additions & 26 deletions Lib/test/test_unicodedata.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,32 +276,32 @@ def test_east_asian_width_9_0_changes(self):
self.assertEqual(self.db.ucd_3_2_0.east_asian_width('\u231a'), 'N')
self.assertEqual(self.db.east_asian_width('\u231a'), 'W')

def test_isidstart(self):
self.assertTrue(self.db.isidstart('S'))
self.assertTrue(self.db.isidstart('\u0AD0')) # GUJARATI OM
self.assertTrue(self.db.isidstart('\u0EC6')) # LAO KO LA
self.assertTrue(self.db.isidstart('\u17DC')) # KHMER SIGN AVAKRAHASANYA
self.assertTrue(self.db.isidstart('\uA015')) # YI SYLLABLE WU
self.assertTrue(self.db.isidstart('\uFE7B')) # ARABIC KASRA MEDIAL FORM

self.assertFalse(self.db.isidstart(' '))
self.assertFalse(self.db.isidstart('0'))
self.assertRaises(TypeError, self.db.isidstart)
self.assertRaises(TypeError, self.db.isidstart, 'xx')

def test_isidcontinue(self):
self.assertTrue(self.db.isidcontinue('S'))
self.assertTrue(self.db.isidcontinue('_'))
self.assertTrue(self.db.isidcontinue('0'))
self.assertTrue(self.db.isidcontinue('\u00BA')) # MASCULINE ORDINAL INDICATOR
self.assertTrue(self.db.isidcontinue('\u0640')) # ARABIC TATWEEL
self.assertTrue(self.db.isidcontinue('\u0710')) # SYRIAC LETTER ALAPH
self.assertTrue(self.db.isidcontinue('\u0B3E')) # ORIYA VOWEL SIGN AA
self.assertTrue(self.db.isidcontinue('\u17D7')) # KHMER SIGN LEK TOO

self.assertFalse(self.db.isidcontinue(' '))
self.assertRaises(TypeError, self.db.isidcontinue)
self.assertRaises(TypeError, self.db.isidcontinue, 'xx')
def test_isxidstart(self):
self.assertTrue(self.db.isxidstart('S'))
self.assertTrue(self.db.isxidstart('\u0AD0')) # GUJARATI OM
self.assertTrue(self.db.isxidstart('\u0EC6')) # LAO KO LA
self.assertTrue(self.db.isxidstart('\u17DC')) # KHMER SIGN AVAKRAHASANYA
self.assertTrue(self.db.isxidstart('\uA015')) # YI SYLLABLE WU
self.assertTrue(self.db.isxidstart('\uFE7B')) # ARABIC KASRA MEDIAL FORM

self.assertFalse(self.db.isxidstart(' '))
self.assertFalse(self.db.isxidstart('0'))
self.assertRaises(TypeError, self.db.isxidstart)
self.assertRaises(TypeError, self.db.isxidstart, 'xx')

def test_isxidcontinue(self):
self.assertTrue(self.db.isxidcontinue('S'))
self.assertTrue(self.db.isxidcontinue('_'))
self.assertTrue(self.db.isxidcontinue('0'))
self.assertTrue(self.db.isxidcontinue('\u00BA')) # MASCULINE ORDINAL INDICATOR
self.assertTrue(self.db.isxidcontinue('\u0640')) # ARABIC TATWEEL
self.assertTrue(self.db.isxidcontinue('\u0710')) # SYRIAC LETTER ALAPH
self.assertTrue(self.db.isxidcontinue('\u0B3E')) # ORIYA VOWEL SIGN AA
self.assertTrue(self.db.isxidcontinue('\u17D7')) # KHMER SIGN LEK TOO

self.assertFalse(self.db.isxidcontinue(' '))
self.assertRaises(TypeError, self.db.isxidcontinue)
self.assertRaises(TypeError, self.db.isxidcontinue, 'xx')

class UnicodeMiscTest(UnicodeDatabaseTest):

Expand Down
38 changes: 19 additions & 19 deletions Modules/clinic/unicodedata.c.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 8 additions & 8 deletions Modules/unicodedata.c
Original file line number Diff line number Diff line change
Expand Up @@ -1527,7 +1527,7 @@ unicodedata_UCD_name_impl(PyObject *self, int chr, PyObject *default_value)
}

/*[clinic input]
unicodedata.UCD.isidstart
unicodedata.UCD.isxidstart

self: self
chr: int(accept={str})
Expand All @@ -1538,8 +1538,8 @@ Return True if the character has the XID_Start property, else False.
[clinic start generated code]*/

static PyObject *
unicodedata_UCD_isidstart_impl(PyObject *self, int chr)
/*[clinic end generated code: output=29fbeaf6491d9f85 input=b71b6b1b2db3c16d]*/
unicodedata_UCD_isxidstart_impl(PyObject *self, int chr)
/*[clinic end generated code: output=944005823c72c3ef input=9353f88d709c21fb]*/
{
if (UCD_Check(self)) {
const change_record *old = get_old_record(self, chr);
Expand All @@ -1553,7 +1553,7 @@ unicodedata_UCD_isidstart_impl(PyObject *self, int chr)
}

/*[clinic input]
unicodedata.UCD.isidcontinue
unicodedata.UCD.isxidcontinue

self: self
chr: int(accept={str})
Expand All @@ -1564,8 +1564,8 @@ Return True if the character has the XID_Continue property, else False.
[clinic start generated code]*/

static PyObject *
unicodedata_UCD_isidcontinue_impl(PyObject *self, int chr)
/*[clinic end generated code: output=5ae694da0ee16534 input=01b4ccd399484e6b]*/
unicodedata_UCD_isxidcontinue_impl(PyObject *self, int chr)
/*[clinic end generated code: output=9438dcbff5ca3e41 input=bbb8dd3ac0d2d709]*/
{
if (UCD_Check(self)) {
const change_record *old = get_old_record(self, chr);
Expand Down Expand Up @@ -1643,8 +1643,8 @@ static PyMethodDef unicodedata_functions[] = {
UNICODEDATA_UCD_EAST_ASIAN_WIDTH_METHODDEF
UNICODEDATA_UCD_DECOMPOSITION_METHODDEF
UNICODEDATA_UCD_NAME_METHODDEF
UNICODEDATA_UCD_ISIDSTART_METHODDEF
UNICODEDATA_UCD_ISIDCONTINUE_METHODDEF
UNICODEDATA_UCD_ISXIDSTART_METHODDEF
UNICODEDATA_UCD_ISXIDCONTINUE_METHODDEF
UNICODEDATA_UCD_LOOKUP_METHODDEF
UNICODEDATA_UCD_IS_NORMALIZED_METHODDEF
UNICODEDATA_UCD_NORMALIZE_METHODDEF
Expand Down
Loading