On 18 August 2010 01:30, Robert Bradshaw <[email protected]> wrote: > On Tue, Aug 17, 2010 at 7:43 PM, Lisandro Dalcin <[email protected]> wrote: >> I'm working on a patch trying to (you know me!) silent GCC unused >> warnings for special methods like __idiv__/__div__ that get generated >> but not used under a Py 3 runtime... > > Yay. > >> In the process, I would like to >> make a little cleanup in TypeSlots.py... One of these cleanups, is >> related to the 'flag' argument to SlotDescriptor.__init__() .. >> Currently, it's only usage is to conditionally fill the nb_index slot. >> >> In short, instead of defining the slot as: >> >> MethodSlot(unaryfunc, "nb_index", "__index__", flag = >> "Py_TPFLAGS_HAVE_INDEX") >> >> I'll do it like this: >> >> MethodSlot(unaryfunc, "nb_index", "__index__", ifdef = >> ""PY_VERSION_HEX >= 0x02050000"") >> >> >> Comments ? > > I think Py_TPFLAGS_HAVE_INDEX is more explicit, >
This macro is not defined in Py<2.5, Cython defines it to 0 (zero) in Py3 ... This is contrary to the way Py_TPFLAGS_HAVE_NEWBUFFER is defined (by Cython) to 0 in both Py<2.6 and Py3. I really like to review these inconsistencies. But a necesary previous step is to get rid of unnecesary usages of Py_TPFLAGS_HAVE_INDEX. > so I prefer that, but > can't you use the latter form when there isn't already a flag? That's > orthogonal to the name, which I could go either way on. > Yes, basically I'm trying to conditionally fill the slot based on Python version, and not in the definition/value of Py_TPFLAGS_HAVE_INDEX. -- 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
