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 ronaldoussoren
Recipients ronaldoussoren
Date 2012-06-08.09:22:48
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1339147370.98.0.5823346157.issue15035@psf.upfronthosting.co.za>
In-reply-to
Content
I'm sometimes using an array.array with format character "u" as a writable backing store for buffers shared with platform APIs that access buffers of UCS2 values. This works fine in python 3.2 and earlier with a ucs2 build of python, but no longer works with python 3.3 because the "u" character explicitly selects a UCS4 representation in that version.

An example of how I use this is using PyObjC on MacOSX, for example:

b = array.array('u', "hello world")
s = CFStringCreateMutableWithExternalCharactersNoCopy(                      
        None, b, len(b), len(b), kCFAllocatorNull)

"s" now refers to a mutable Objective-C string that uses "b" as its backing store.

It would be nice if there were a format code that would allow me to do this with Python 3.3, for example   b = array.array("U", ...)


(BTW. I'm sorry if this is a duplicate, searching for "array.array" on the tracker results in a lot of hits, most of which have nothing to do with the array module)
History
Date User Action Args
2012-06-08 09:22:51ronaldoussorensetrecipients: + ronaldoussoren
2012-06-08 09:22:50ronaldoussorensetmessageid: <1339147370.98.0.5823346157.issue15035@psf.upfronthosting.co.za>
2012-06-08 09:22:50ronaldoussorenlinkissue15035 messages
2012-06-08 09:22:48ronaldoussorencreate