1#ifndef Py_LIMITED_API
2#ifndef PYCTYPE_H
3#define PYCTYPE_H
4#ifdef __cplusplus
5extern "C" {
6#endif
7
8#define PY_CTF_LOWER 0x01
9#define PY_CTF_UPPER 0x02
10#define PY_CTF_ALPHA (PY_CTF_LOWER|PY_CTF_UPPER)
11#define PY_CTF_DIGIT 0x04
12#define PY_CTF_ALNUM (PY_CTF_ALPHA|PY_CTF_DIGIT)
13#define PY_CTF_SPACE 0x08
14#define PY_CTF_XDIGIT 0x10
15
16PyAPI_DATA(const unsigned int) _Py_ctype_table[256];
17
18/* Unlike their C counterparts, the following macros are not meant to
19 * handle an int with any of the values [EOF, 0-UCHAR_MAX]. The argument
20 * must be a signed/unsigned char. */
21#define Py_ISLOWER(c) (_Py_ctype_table[Py_CHARMASK(c)] & PY_CTF_LOWER)
22#define Py_ISUPPER(c) (_Py_ctype_table[Py_CHARMASK(c)] & PY_CTF_UPPER)
23#define Py_ISALPHA(c) (_Py_ctype_table[Py_CHARMASK(c)] & PY_CTF_ALPHA)
24#define Py_ISDIGIT(c) (_Py_ctype_table[Py_CHARMASK(c)] & PY_CTF_DIGIT)
25#define Py_ISXDIGIT(c) (_Py_ctype_table[Py_CHARMASK(c)] & PY_CTF_XDIGIT)
26#define Py_ISALNUM(c) (_Py_ctype_table[Py_CHARMASK(c)] & PY_CTF_ALNUM)
27#define Py_ISSPACE(c) (_Py_ctype_table[Py_CHARMASK(c)] & PY_CTF_SPACE)
28
29PyAPI_DATA(const unsigned char) _Py_ctype_tolower[256];
30PyAPI_DATA(const unsigned char) _Py_ctype_toupper[256];
31
32#define Py_TOLOWER(c) (_Py_ctype_tolower[Py_CHARMASK(c)])
33#define Py_TOUPPER(c) (_Py_ctype_toupper[Py_CHARMASK(c)])
34
35#ifdef __cplusplus
36}
37#endif
38#endif /* !PYCTYPE_H */
39#endif /* !Py_LIMITED_API */
40

source code of include/python3.10/cpython/pyctype.h