Message108234
This feature request is extracted from issue 9020, where Py_CHARMASK(c)
was used on EOF, producing different results depending on whether __CHAR_UNSIGNED__ is defined or not.
The preferred fix for issue 9020 is to check for EOF before using
Py_CHARMASK, so this is only loosely related.
I've looked through the source tree to determine how Py_CHARMASK
is meant to be used. It seems that it is only used in situations
where one would actually want to cast a char to an unsigned char,
like isspace((unsigned char)c).
Simplifications:
1) Python.h already enforces that an unsigned char is 8 bit wide. Thus,
((unsigned char)((c) & 0xff)) and ((unsigned char)(c)) should produce
the same results.
2) There is no reason not to do the cast when __CHAR_UNSIGNED__ is
defined (it will be a no-op). |
|
Date |
User |
Action |
Args |
2010-06-20 13:12:08 | skrah | set | recipients:
+ skrah, loewis, pitrou, eric.smith |
2010-06-20 13:12:08 | skrah | set | messageid: <1277039528.15.0.539020018856.issue9036@psf.upfronthosting.co.za> |
2010-06-20 13:12:05 | skrah | link | issue9036 messages |
2010-06-20 13:12:05 | skrah | create | |
|