Message270474
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:48 | Oren Milman | set | recipients:
+ Oren Milman, terry.reedy, mark.dickinson, ezio.melotti, serhiy.storchaka |
2016-07-15 09:57:48 | Oren Milman | set | messageid: <1468576668.15.0.165089814331.issue15988@psf.upfronthosting.co.za> |
2016-07-15 09:57:48 | Oren Milman | link | issue15988 messages |
2016-07-15 09:57:48 | Oren Milman | create | |
|