New submission from Ronald Oussoren <[email protected]>:
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)
----------
components: Extension Modules
messages: 162520
nosy: ronaldoussoren
priority: low
severity: normal
status: open
title: array.array of UCS2 values
type: behavior
versions: Python 3.3
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue15035>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com