Neal Norwitz wrote: > > 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? To answer my own question, it appears that I should use PyFloat_AsDouble() and PyInt_AsLong() and check for an error. I don't know why I didn't do this before. This restores the original behaviour. I'll check this in later. Let me know if I screwed up again. I'll also update the tests to check for the exception. 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