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

Michael Hudson mwh@python.net
10 Jul 2002 16:29:14 +0100


=?ISO-8859-15?Q?Walter_D=F6rwald?= <walter@livinglogic.de> writes:

> 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.

*It* needs to know, yes.  But surely the caller doesn't?

> > 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.

They're verboten in extension modules anyway, so I don't care.

Cheers,
M.

-- 
  Like most people, I don't always agree with the BDFL (especially
  when he wants to change things I've just written about in very 
  large books), ... 
         -- Mark Lutz, http://python.oreilly.com/news/python_0501.html