Oren Milman added the comment:

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.'?

----------
nosy: +Oren Milman

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue15988>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to