summaryrefslogtreecommitdiffstats
path: root/Include/Python.h
diff options
context:
space:
mode:
authorStefan Krah <stefan@bytereef.org>2010-07-19 12:36:57 (GMT)
committerStefan Krah <stefan@bytereef.org>2010-07-19 12:36:57 (GMT)
commit36d2e67db9a53175accad32454af6316d6b12b82 (patch)
tree841d1e8a172e7cbf56ee8a3e41d7d164bfcb0701 /Include/Python.h
parent067425520e68073c991a8e750e008b23b2564c68 (diff)
downloadcpython-36d2e67db9a53175accad32454af6316d6b12b82.zip
cpython-36d2e67db9a53175accad32454af6316d6b12b82.tar.gz
cpython-36d2e67db9a53175accad32454af6316d6b12b82.tar.bz2
Issue #9036: Throughout the code base, Py_CHARMASK is used on 8-bit wide
signed/unsigned chars or on integers directly derived from those. In all cases, it could be replaced by a simple cast to (unsigned char). Reasons for the change: a) Make the comment more explicit. b) If char is unsigned, the cast is optimized away. c) If char is unsigned, gcc emits spurious "array subscript has type 'char'" warnings.
Diffstat (limited to 'Include/Python.h')
-rw-r--r--Include/Python.h7
1 files changed, 1 insertions, 6 deletions
diff --git a/Include/Python.h b/Include/Python.h
index c0e469e..972beec 100644
--- a/Include/Python.h
+++ b/Include/Python.h
@@ -134,13 +134,8 @@ PyAPI_FUNC(wchar_t *) _Py_char2wchar(char *);
}
#endif
-/* Convert a possibly signed character to a nonnegative int */
-/* XXX This assumes characters are 8 bits wide */
-#ifdef __CHAR_UNSIGNED__
-#define Py_CHARMASK(c) (c)
-#else
+/* Argument must be a char or an int in [-128, 127] or [0, 255]. */
#define Py_CHARMASK(c) ((unsigned char)((c) & 0xff))
-#endif
#include "pyfpe.h"