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 vstinner
Recipients lemburg, mark.dickinson, rpetrov, vstinner
Date 2009-01-21.02:05:08
SpamBayes Score 1.0832689e-09
Marked as misclassified No
Message-id <1232503511.22.0.28498485797.issue4474@psf.upfronthosting.co.za>
In-reply-to
Content
> Also note that on platforms with 16-bit wchar_t, the comparison
> (0xffff < *w) will always be false, so an additional check for
> (Py_UNICODE_SIZE > 2) is needed.

Yes, but the right test is (SIZEOF_WCHAR_T > 2). I wrote a new test:

#if (Py_UNICODE_SIZE == 2) && (SIZEOF_WCHAR_T > 2)
#define USE_WCHAR_SURROGATE
    const wchar_t *orig_w;
#endif

> BTW: Please always use upper-case hex literals, or at leat don't
> mix the case within the same function.

I try, but it would be easier if the rule was already respected: they 
are many tabs and many lower-case hex literals. I used copy/paste from 
existing code of unicodeobject.c...

Patch version 3:
 - disable the UTF-16 surrogate for 16 bits wchar_t: so my patch is 
only used for 16 bits Py_UNICODE and 32 bits wchar_t... which is the 
default case for python 2.6 and 3.0 on Linux
 - replace tabulation by spaces (in existing code)
 - use upper case literals
History
Date User Action Args
2009-01-21 02:05:11vstinnersetrecipients: + vstinner, lemburg, mark.dickinson, rpetrov
2009-01-21 02:05:11vstinnersetmessageid: <1232503511.22.0.28498485797.issue4474@psf.upfronthosting.co.za>
2009-01-21 02:05:10vstinnerlinkissue4474 messages
2009-01-21 02:05:09vstinnercreate