[pypy-dev] [cpyext] partial fake PEP393 implementation to provide access to single unicode characters in strings

Amaury Forgeot d'Arc amauryfa at gmail.com
Fri Apr 20 11:02:57 CEST 2012


2012/4/20 Armin Rigo <arigo at tunes.org>

> On Sat, Apr 14, 2012 at 18:44, Stefan Behnel <stefan_ml at behnel.de> wrote:
> > PEP393 (the new Unicode type in Py3.3) defines a rather useful C
> interface
> > towards the characters of a Unicode string. I think it would be cool if
> > cpyext provided that, so that access to single characters won't require
> > copying the unicode buffer into C space anymore.
>
> FWIW, if it makes sense, you can add PyPy-specific API functions not
> in the standard CPython C API, too.  I'm thinking about accessing
> *string* characters, for example.


But is it desirable? The first call to PyUnicode_AsUnicode will allocate
and copy the unicode buffer,
but subsequent calls will quickly return the same address.

-- 
Amaury Forgeot d'Arc
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/pypy-dev/attachments/20120420/2c07035b/attachment.html>


More information about the pypy-dev mailing list