[Cython] [PATCH] Make __Pyx_ArgTypeTest() use "const char*" to suppress warning
Robert Bradshaw
robertwb at math.washington.edu
Thu Sep 11 07:13:59 CEST 2008
On Sep 10, 2008, at 12:42 PM, Lisandro Dalcin wrote:
> On Wed, Sep 10, 2008 at 4:04 PM, Stefan Behnel
> <stefan_ml at behnel.de> wrote:
>> Hi,
>> We are totally not discussing our own GetAttrString() at this
>> point (which is
>> only used in a couple of less important places anyway).
>
> But if GetAttrString() is still used in C code, then it has to handle
> the different signatures for 2.3/24 and 2.5/2.6/3.0. So then perhaps
> the less intrusive change is to generate a custom function
>
> PyObject* __Pyx_GetAttrString(PyObject*, const char*);
+1 to this idea.
>> Interning the string at module init time would only pay off if
>> it's used
>> elsewhere in a performance critical part of the code later on,
>> which is not so
>> likely for a class name.
>
> I actually agree in this point, but perhaps the approach I commented
> above still applies.
>
> I do not see any semantic difference in using PyString_FromString() or
> PyString_InternFromString(). Both calls return a new reference you own
> and next have to DECREF. I do not really have any strong complaint
> about Stefan's way for the particular case of importing a type from a
> module.
If we're going to be using this elsewhere, we should be using
PyString_InternFromString. For most attribute lookups we should be
using pre-generated interned strings.
- Robert
More information about the Cython-dev
mailing list