summaryrefslogtreecommitdiffstats
path: root/Include
diff options
context:
space:
mode:
authorStefan Krah <stefan@bytereef.org>2010-07-19 13:14:01 (GMT)
committerStefan Krah <stefan@bytereef.org>2010-07-19 13:14:01 (GMT)
commita1775944ae4f9770aa5980a2c2a5454d3994db25 (patch)
treecd482727ae2d73521932b143f09ec85cd3b737a5 /Include
parent682f60352e782dae1c01e8b77a6150ef5669ee74 (diff)
downloadcpython-a1775944ae4f9770aa5980a2c2a5454d3994db25.zip
cpython-a1775944ae4f9770aa5980a2c2a5454d3994db25.tar.gz
cpython-a1775944ae4f9770aa5980a2c2a5454d3994db25.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')
-rw-r--r--Include/Python.h7
1 files changed, 1 insertions, 6 deletions
diff --git a/Include/Python.h b/Include/Python.h
index 75d2b10..775412b 100644
--- a/Include/Python.h
+++ b/Include/Python.h
@@ -150,13 +150,8 @@ PyAPI_FUNC(PyObject*) _Py_Mangle(PyObject *p, PyObject *name);
Set ml_flags in the PyMethodDef to METH_NOARGS. */
#define PyArg_NoArgs(v) PyArg_Parse(v, "")
-/* 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"