Skip to content

Commit 5bf0664

Browse files
committed
Merged revisions 82966 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k ........ r82966 | stefan.krah | 2010-07-19 14:36:57 +0200 (Mon, 19 Jul 2010) | 13 lines 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. ........
1 parent 18b0056 commit 5bf0664

1 file changed

Lines changed: 1 addition & 6 deletions

File tree

Include/Python.h

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -126,13 +126,8 @@
126126
/* _Py_Mangle is defined in compile.c */
127127
PyAPI_FUNC(PyObject*) _Py_Mangle(PyObject *p, PyObject *name);
128128

129-
/* Convert a possibly signed character to a nonnegative int */
130-
/* XXX This assumes characters are 8 bits wide */
131-
#ifdef __CHAR_UNSIGNED__
132-
#define Py_CHARMASK(c) (c)
133-
#else
129+
/* Argument must be a char or an int in [-128, 127] or [0, 255]. */
134130
#define Py_CHARMASK(c) ((unsigned char)((c) & 0xff))
135-
#endif
136131

137132
#include "pyfpe.h"
138133

0 commit comments

Comments
 (0)