A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2002-July/026989.html below:

[Python-Dev] Re: [Python-checkins] python/dist/src/Objects stringobject.c,2.171,2.172

[Python-Dev] Re: [Python-checkins] python/dist/src/Objects stringobject.c,2.171,2.172Neal Norwitz neal@metaslash.com
Sun, 28 Jul 2002 12:13:12 -0400
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



RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4