[issue8941] utf-32be codec failing on UCS-2 python build for 32-bit value

2010-06-11 Thread Antoine Pitrou
Antoine Pitrou added the comment: Fixed in r81907 (trunk), r81908 (py3k), r81909 (2.6), r81910 (3.1). -- resolution: -> fixed status: open -> closed ___ Python tracker ___ _

[issue8941] utf-32be codec failing on UCS-2 python build for 32-bit value

2010-06-09 Thread Marc-Andre Lemburg
Marc-Andre Lemburg added the comment: Antoine Pitrou wrote: > > Antoine Pitrou added the comment: > > Here is a new patch with tests. > >> I wonder whether it wouldn't be better to preallocate >> a Unicode object with size of e.g. size/4 + 16 and >> then resize the object as necessary in cas

[issue8941] utf-32be codec failing on UCS-2 python build for 32-bit value

2010-06-09 Thread Antoine Pitrou
Antoine Pitrou added the comment: Here is a new patch with tests. > I wonder whether it wouldn't be better to preallocate > a Unicode object with size of e.g. size/4 + 16 and > then resize the object as necessary in case a surrogate > pair needs to be created (won't happen that often in > pract

[issue8941] utf-32be codec failing on UCS-2 python build for 32-bit value

2010-06-09 Thread Ezio Melotti
Changes by Ezio Melotti : -- nosy: +ezio.melotti stage: -> unit test needed ___ Python tracker ___ ___ Python-bugs-list mailing list U

[issue8941] utf-32be codec failing on UCS-2 python build for 32-bit value

2010-06-09 Thread Marc-Andre Lemburg
Marc-Andre Lemburg added the comment: Antoine Pitrou wrote: > > Antoine Pitrou added the comment: > > The following code at the beginning of PyUnicode_DecodeUTF32Stateful is buggy > when codec endianness doesn't match the native endianness (not to mention it > could also crash if the underl

[issue8941] utf-32be codec failing on UCS-2 python build for 32-bit value

2010-06-09 Thread Antoine Pitrou
Antoine Pitrou added the comment: Here is a simple patch. A test should be added, though. -- keywords: +patch Added file: http://bugs.python.org/file17596/utf32.patch ___ Python tracker

[issue8941] utf-32be codec failing on UCS-2 python build for 32-bit value

2010-06-09 Thread Antoine Pitrou
Changes by Antoine Pitrou : -- nosy: +doerwalter ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.pyt

[issue8941] utf-32be codec failing on UCS-2 python build for 32-bit value

2010-06-09 Thread Antoine Pitrou
Antoine Pitrou added the comment: The following code at the beginning of PyUnicode_DecodeUTF32Stateful is buggy when codec endianness doesn't match the native endianness (not to mention it could also crash if the underlying CPU arch doesn't support unaligned access to 4-byte integers): #ifnd

[issue8941] utf-32be codec failing on UCS-2 python build for 32-bit value

2010-06-09 Thread Antoine Pitrou
Antoine Pitrou added the comment: Also witnessed on 2.x (UCS-2 build): >>> unicode(b'\x00\x01\x00\x00', 'utf-32be') u'\ud800\u0773' >>> unicode(b'\x00\x00\x01\x00', 'utf-32le') u'\U0001' -- nosy: +haypo, lemburg, pitrou priority: normal -> high title: utf-32be codec failing on 16-b