Skip to content

Commit cf197af

Browse files
Part of review
1 parent 9043865 commit cf197af

File tree

3 files changed

+11
-13
lines changed

3 files changed

+11
-13
lines changed

Doc/library/unicodedata.rst

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,9 @@ following functions:
146146

147147
.. function:: isidstart(chr, /)
148148

149-
Return ``True`` if the character has the ``XID_Start`` property, ``False``
150-
otherwise. For example::
149+
Return ``True`` if *chr* is a valid identifier start per the
150+
`Unicode Standard Annex #31 <https://www.unicode.org/reports/tr31/>`_,
151+
that is, it has the ``XID_Start`` property, ``False`` otherwise. For example::
151152

152153
>>> unicodedata.isidstart('S')
153154
True
@@ -159,8 +160,9 @@ following functions:
159160

160161
.. function:: isidcontinue(chr, /)
161162

162-
Return ``True`` if the character has the ``XID_Continue`` property, ``False``
163-
otherwise. For example::
163+
Return ``True`` if *chr* is a valid identifier charcter per the
164+
`Unicode Standard Annex #31 <https://www.unicode.org/reports/tr31/>`_,
165+
that is, it has the ``XID_Continue`` property, ``False`` otherwise. For example::
164166

165167
>>> unicodedata.isidcontinue('S')
166168
True

Modules/unicodedata.c

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1541,17 +1541,15 @@ static PyObject *
15411541
unicodedata_UCD_isidstart_impl(PyObject *self, int chr)
15421542
/*[clinic end generated code: output=29fbeaf6491d9f85 input=b71b6b1b2db3c16d]*/
15431543
{
1544-
Py_UCS4 c = (Py_UCS4)chr;
1545-
15461544
if (UCD_Check(self)) {
1547-
const change_record *old = get_old_record(self, c);
1545+
const change_record *old = get_old_record(self, chr);
15481546
if (old->category_changed == 0) {
15491547
/* unassigned */
15501548
Py_RETURN_FALSE;
15511549
}
15521550
}
15531551

1554-
return PyBool_FromLong(_PyUnicode_IsXidStart(c));
1552+
return PyBool_FromLong(_PyUnicode_IsXidStart(chr));
15551553
}
15561554

15571555
/*[clinic input]
@@ -1569,17 +1567,15 @@ static PyObject *
15691567
unicodedata_UCD_isidcontinue_impl(PyObject *self, int chr)
15701568
/*[clinic end generated code: output=5ae694da0ee16534 input=01b4ccd399484e6b]*/
15711569
{
1572-
Py_UCS4 c = (Py_UCS4)chr;
1573-
15741570
if (UCD_Check(self)) {
1575-
const change_record *old = get_old_record(self, c);
1571+
const change_record *old = get_old_record(self, chr);
15761572
if (old->category_changed == 0) {
15771573
/* unassigned */
15781574
Py_RETURN_FALSE;
15791575
}
15801576
}
15811577

1582-
return PyBool_FromLong(_PyUnicode_IsXidContinue(c));
1578+
return PyBool_FromLong(_PyUnicode_IsXidContinue(chr));
15831579
}
15841580

15851581
/*[clinic input]

Objects/unicodectype.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
*/
1010

1111
#include "Python.h"
12-
#include "pycore_unicodedata.h" // _PyUnicode_IsXidStart, _PyUnicode_IsXidContinue
12+
#include "pycore_unicodedata.h" // export _PyUnicode_IsXidStart(), _PyUnicode_IsXidContinue()
1313

1414
#define ALPHA_MASK 0x01
1515
#define DECIMAL_MASK 0x02

0 commit comments

Comments
 (0)