[Python-Dev] Python API version & optional features

M.-A. Lemburg mal@lemburg.com
Fri, 03 Aug 2001 11:13:56 +0200

"Martin v. Loewis" wrote:
> > Shouldn't Python automatically Do The Right Thing in that case? That
> > would mean wrapping the UCS4 calls in a conversion layer, which
> > isn't hard. I mean, it's just a question of adding or taking away
> > zeroes, right? :)
> Given the smiley at the end of your message, I don't know whether you
> meant your point seriously or not.
> I believe it is impossible for Python to do what you seem to think as
> the "Right Thing". E.g. modules that use PyUnicode_AS_UNICODE will
> behave differently when sizeof(Py_UNICODE) changes. Since this is a
> macro, you cannot change their behavior at run-time; they have
> assumption on the size of Py_UNICODE compiled-in.

I've already checked in a patch which applies API name mangling
to the Unicode APIs. The linker will then generate error
messages which Python reports as ImportError in case there
should be a mismatch in the sizeof(Py_UNICODE).

The only thing which we require is that a Unicode aware
extension use at least one of the mangled APIs -- shouldn't
be much of a requirement, though :-)

Marc-Andre Lemburg
CEO eGenix.com Software GmbH
Company & Consulting:                           http://www.egenix.com/
Python Software:                        http://www.lemburg.com/python/