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.

Author Oren Milman
Recipients Oren Milman, ezio.melotti, mark.dickinson, serhiy.storchaka, terry.reedy
Date 2016-07-15.09:57:48
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
I would be happy to write a patch for this issue, if you don't mind.

Terry, as you were the one to commit the patch for #21559, I guess you are OK with keeping the OverflowError.
Also, I agree that the error message for '_testcapi.getargs_b(-1)' (and for similar cases) could be improved. IMHO, the wording in PyLong_AsLong is quite clear, and also fits here, e.g. 'Python int too small to convert to C unsigned byte' for '_testcapi.getargs_b(-1)'.

ISTM that implementing the patch by doing the following is quite straightforward:
- replacing PyLong_AsLong with PyLong_AsLongAndOverflow (as Serhiy suggested) in cases 'b', 'h' and 'i', in convertsimple in getargs.c
- changing some error messages in convertsimple
- changing PyLong_AsLong and _PyLong_AsInt so that they too would give more helpful error messages (according to the long-lived suggestions of '/* XXX: could be cute and give a different message for overflow == -1 */')

Serhiy, what did you mean by 'Unify an integer overflow error messages in different functions.'?
Date User Action Args
2016-07-15 09:57:48Oren Milmansetrecipients: + Oren Milman, terry.reedy, mark.dickinson, ezio.melotti, serhiy.storchaka
2016-07-15 09:57:48Oren Milmansetmessageid: <>
2016-07-15 09:57:48Oren Milmanlinkissue15988 messages
2016-07-15 09:57:48Oren Milmancreate