This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author skrah
Recipients eric.smith, loewis, pitrou, skrah
Date 2010-06-20.13:12:04
SpamBayes Score 0.060288098
Marked as misclassified No
Message-id <1277039528.15.0.539020018856.issue9036@psf.upfronthosting.co.za>
In-reply-to
Content
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).
History
Date User Action Args
2010-06-20 13:12:08skrahsetrecipients: + skrah, loewis, pitrou, eric.smith
2010-06-20 13:12:08skrahsetmessageid: <1277039528.15.0.539020018856.issue9036@psf.upfronthosting.co.za>
2010-06-20 13:12:05skrahlinkissue9036 messages
2010-06-20 13:12:05skrahcreate