[Python-Dev] The C API and wide unicode support

Walter Dörwald walter@livinglogic.de
Wed, 10 Jul 2002 17:25:09 +0200


Guido van Rossum wrote:

>>Any C function that uses Unicode objects in any way needs name
>>mangling, because the storage layout of the Unicode objects
>>changes.
> 
> 
> Really?  If I am only using the published APIs and not peeking
> directly inside the Unicode object, why should I care about its
> internal lay-out?

That's what I meant with "using". Function that only pass
unicode objects around don't need to know (as long as they pass
the objects only to functions that themselves either "know"
or "don't need to know" the layout).

PyUnicode_Decode creates unicode objects, so I guess it needs
to know.

> Shouldn't only functions whose signature uses PY_UNICODE_TYPE be
> name-mangled?  What am I missing?

What about the functions that use the C macros (PyUnicode_AS_UNICODE
etc.) directly or indirectly? Those functions will rely on the
internal lay-out.

Bye,
    Walter Dörwald