[Python-3000] PyUnicodeObject implementation

Stefan Behnel stefan_ml at behnel.de
Tue Sep 9 08:03:16 CEST 2008


Martin v. Löwis wrote:
>> I wouldn't mind letting Cython special case subtypes of str (or unicode in
>> Py3) *somehow*, as long as this "somewhow" proves to be a viable solution that
>> only applies to exactly those types *and* can be done realiably for subtypes
>> of subtypes. I'm just not aware of such a solution.
> 
> As people have pointed out: add new fields *after* the variable-sized
> members. To access it, you need to compute the length of the base
> object, and then cast the pointer to an extension struct.
> 
> That extends to further subtypes, too.

Thanks Martin, Antoine,

this still requires some figuring out of the details for Cython, but I agree
that Cython is a good place to handle this problem and to fix it for both Py2
and whatever Py3 will add to it.

Martin, you compared these things to rocket science, so let me quote a variant
of what some of the Jython people tend to say:

    "Cython - we write C so you don't have to."

Stefan



More information about the Python-3000 mailing list