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 stutzbach
Recipients stutzbach, theller
Date 2010-05-09.06:38:31
SpamBayes Score 2.0174829e-07
Marked as misclassified No
Message-id <1273387114.89.0.416578803449.issue8670@psf.upfronthosting.co.za>
In-reply-to
Content
Using a UCS2 Python on a platform with a 32-bit wchar_t, the following code throws an exception (but should not):

>>> ctypes.c_wchar('\u10000')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: one character unicode string expected

The trouble is in the u_set() function in Modules/_ctypes/cfield.c.  The corresponding u_get() function looks correct.

On a UCS4 Python running on a system with a 16-bit wchar_t, u_set() will corrupt the data by silently truncating the character to 16-bits.

For reference, Linux and Mac OS use a 32-bit wchar_t while Windows uses a 16-bit wchar_t.
History
Date User Action Args
2010-05-09 06:38:35stutzbachsetrecipients: + stutzbach, theller
2010-05-09 06:38:34stutzbachsetmessageid: <1273387114.89.0.416578803449.issue8670@psf.upfronthosting.co.za>
2010-05-09 06:38:32stutzbachlinkissue8670 messages
2010-05-09 06:38:31stutzbachcreate