Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f03e741

Browse files
committed
Modified the ISALPHA and ISALNUM macros to use the new lookup APIs
from unicodectype.c
1 parent 82249c8 commit f03e741

1 file changed

Lines changed: 8 additions & 5 deletions

File tree

Include/unicodeobject.h

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,8 @@ typedef unsigned short Py_UNICODE;
137137
#define Py_UNICODE_TODIGIT(ch) _PyUnicode_ToDigit(ch)
138138
#define Py_UNICODE_TONUMERIC(ch) _PyUnicode_ToNumeric(ch)
139139

140+
#define Py_UNICODE_ISALPHA(ch) iswalpha(ch)
141+
140142
#else
141143

142144
#define Py_UNICODE_ISSPACE(ch) _PyUnicode_IsWhitespace(ch)
@@ -158,12 +160,9 @@ typedef unsigned short Py_UNICODE;
158160
#define Py_UNICODE_TODIGIT(ch) _PyUnicode_ToDigit(ch)
159161
#define Py_UNICODE_TONUMERIC(ch) _PyUnicode_ToNumeric(ch)
160162

161-
#endif
163+
#define Py_UNICODE_ISALPHA(ch) _PyUnicode_IsAlpha(ch)
162164

163-
#define Py_UNICODE_ISALPHA(ch) \
164-
(Py_UNICODE_ISLOWER(ch) || \
165-
Py_UNICODE_ISUPPER(ch) || \
166-
Py_UNICODE_ISTITLE(ch))
165+
#endif
167166

168167
#define Py_UNICODE_ISALNUM(ch) \
169168
(Py_UNICODE_ISALPHA(ch) || \
@@ -871,6 +870,10 @@ extern DL_IMPORT(int) _PyUnicode_IsNumeric(
871870
register const Py_UNICODE ch /* Unicode character */
872871
);
873872

873+
extern DL_IMPORT(int) _PyUnicode_IsAlpha(
874+
register const Py_UNICODE ch /* Unicode character */
875+
);
876+
874877
#ifdef __cplusplus
875878
}
876879
#endif

0 commit comments

Comments
 (0)