summaryrefslogtreecommitdiffstats
path: root/Include/pyctype.h
diff options
context:
space:
mode:
authorStefan Krah <stefan@bytereef.org>2010-06-24 09:33:05 (GMT)
committerStefan Krah <stefan@bytereef.org>2010-06-24 09:33:05 (GMT)
commit3db4161011cbf6988102228ffc7e5213e680241e (patch)
treeeaf73fb8d45f47607011b596d1a81ab83fb0576d /Include/pyctype.h
parent947ce58a9018d23cb1e5e8de550f2ba0e542248e (diff)
downloadcpython-3db4161011cbf6988102228ffc7e5213e680241e.zip
cpython-3db4161011cbf6988102228ffc7e5213e680241e.tar.gz
cpython-3db4161011cbf6988102228ffc7e5213e680241e.tar.bz2
Issue #9020: The Py_IS* macros from pyctype.h should generally only be
used with signed/unsigned char arguments. For integer arguments, EOF has to be handled separately.
Diffstat (limited to 'Include/pyctype.h')
-rw-r--r--Include/pyctype.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/Include/pyctype.h b/Include/pyctype.h
index 0d211ec..c5cc614 100644
--- a/Include/pyctype.h
+++ b/Include/pyctype.h
@@ -11,6 +11,9 @@
extern const unsigned int _Py_ctype_table[256];
+/* Unlike their C counterparts, the following macros are not meant to
+ * handle an int with any of the values [EOF, 0-UCHAR_MAX]. The argument
+ * must be a signed/unsigned char. */
#define Py_ISLOWER(c) (_Py_ctype_table[Py_CHARMASK(c)] & PY_CTF_LOWER)
#define Py_ISUPPER(c) (_Py_ctype_table[Py_CHARMASK(c)] & PY_CTF_UPPER)
#define Py_ISALPHA(c) (_Py_ctype_table[Py_CHARMASK(c)] & PY_CTF_ALPHA)