Message162520
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) |
|
Date |
User |
Action |
Args |
2012-06-08 09:22:51 | ronaldoussoren | set | recipients:
+ ronaldoussoren |
2012-06-08 09:22:50 | ronaldoussoren | set | messageid: <1339147370.98.0.5823346157.issue15035@psf.upfronthosting.co.za> |
2012-06-08 09:22:50 | ronaldoussoren | link | issue15035 messages |
2012-06-08 09:22:48 | ronaldoussoren | create | |
|