[New-bugs-announce] [issue4060] PyUnicode_DecodeUTF16(..., byteorder=0) gets it wrong on Mac OS X/PowerPC
report at bugs.python.org
Tue Oct 7 00:27:10 CEST 2008
New submission from Trent Mick <trentm at gmail.com>:
Revision 63955 removed a block from configure.in (and effectively from
pyconfig.h.in) having to do with endianness that results in an incorrect
setting for "WORDS_BIGENDIAN" in Universal builds on Mac OS X.
The removed part was this:
> /* Define to 1 if your processor stores words with the most
> first (like Motorola and SPARC, unlike Intel and VAX).
> The block below does compile-time checking for endianness on
> that use GCC and therefore allows compiling fat binaries on OSX by
> '-arch ppc -arch i386' as the compile flags. The phrasing was
> such that the configure-result is used on systems that don't use
> #ifdef __BIG_ENDIAN__
> #define WORDS_BIGENDIAN 1
> #ifndef __LITTLE_ENDIAN__
> #undef WORDS_BIGENDIAN
This used to allow "WORDS_BIGENDIAN" to be correct for all parts of a
universal Python build done via `gcc -arch i386 -arch ppc ...`.
This was originally added for issue 1471883 (see msg50040 for a
discussion of this particular bit).
The result of this bug is that Python extensions using either of the
following to get native byte ordering for UTF-16 decoding:
PyUnicode_DecodeUTF16Stateful(..., byteorder=0, ...);
on Mac OS X/PowerPC with a universal build built on Intel hardware (most
such builds) will get the wrong byte-ordering.
The fix is to restore that section to configure.in and re-run autoconf
Was there are particular reason that this block was removed from
configure.in (and pyconfig.h.in)?
I'd like to hear comments from either Ronald or Martin, and then I can
commit the fix.
nosy: loewis, ronaldoussoren, trentm
title: PyUnicode_DecodeUTF16(..., byteorder=0) gets it wrong on Mac OS X/PowerPC
versions: Python 2.6
Python tracker <report at bugs.python.org>
More information about the New-bugs-announce