This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: PyArg_ParseTuple can miss errors with warnings as exceptions
Type: Stage:
Components: Interpreter Core Versions: Python 2.3
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: mwh Nosy List: mssf, mwh
Priority: normal Keywords:

Created on 2004-07-15 18:45 by mssf, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (2)
msg21634 - (view) Author: mssf (mssf) Date: 2004-07-15 18:45
in getargs.c, the convertsimple function returns NULL
if a float warning raised an exception, for example
passing a float to an int conversion.

NULL is interpreted by the caller, converttupple, as a
NON-error

The result is that PyArg_ParseTuple returns TRUE even
though it has left the float unconverted (and the
receiving integer variable containing whatever garbage
it contained before the call)

changing the return on the float error from NULL to
"converterr("integer<i>", arg, msgbuf, bufsize);", as
is done with every other error in this function,
corrects the problem.

msg21635 - (view) Author: Michael Hudson (mwh) (Python committer) Date: 2004-08-07 17:57
Logged In: YES 
user_id=6656

You're right, of course.  Fixed as suggested in Python/getargs.c 
revision 2.102.
History
Date User Action Args
2022-04-11 14:56:05adminsetgithub: 40574
2004-07-15 18:45:52mssfcreate