On 16 April 2010 03:25, Stefan Behnel <[email protected]> wrote: > > We should be aware that any defines that we use at the global level can > interfere with user code, e.g. if the user (or an imported header file) > decides to define PyString_Check as a check for plain bytes.
Then such code is broken in Python2.6 and 2.7, as the definitions are already there. > The patch above > shows that we already redefine PyString_CheckExact, so we should either > switch to defining PyString_Check alike or to replacing everything with > __Pyx_PyString*. > > I think the reason why we need the Py3 defines above in the first place is > that Cython can end up generating those names for the 'str' type, right? > Maybe there are other places where we can fix this, so that we do not need > to define PyString_* at all. If we could use __Pyx_PyString_* in all places > where we need Cython's 'str' semantics, we could remove all PyString > definitions above. Similarly, PyBaseString_Type would become > __Pyx_PyBaseString_Type. > So in short you say that we are going to uses PyBytes_XXX, PyUnicode_XXX, and _Pyx_PyString_XXX? That sounds good, any misuse of PyString in Py3 will be easily catched. > Regarding the last part, I'm all for #defining the PyBytes_* API in Py<=2.5 > and using those names wherever we refer to the bytes type. They are the safe > path. > Nice. I'll push this part. -- Lisandro Dalcin --------------- CIMEC (INTEC/CONICET-UNL) Predio CONICET-Santa Fe Colectora RN 168 Km 472, Paraje El Pozo Tel: +54-342-4511594 (ext 1011) Tel/Fax: +54-342-4511169 _______________________________________________ Cython-dev mailing list [email protected] http://codespeak.net/mailman/listinfo/cython-dev
