Fredrik Lundh wrote:
>> > SF patch #577031, remove PyArg_Parse() since it's deprecated
>> > ! v = PyNumber_Float(v);
> > ! if (!v)
> > return -1;
>> > v = PyNumber_Int(v);
> > ! if (!v)
> > return -1;
>> umm.
>> doesn't PyNumber_Float and PyNumber_Int convert its argument to
> a float/integer, if it's not already the right type?
Yes.
> in earlier versions of Python, "%g" % "1.0" raised a TypeError. does
> it still do that with this patch in place?
No. :-( That wasn't an intentional change. The intent was
to convert an int/long to a double in the case of '%g' et al and
from a double to an int in the case of '%d'.
What is the best way to fix this? If I call PyNumber_Check()
before this code, the behaviour is the same as before.
Neal