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: Clarify that the signed number convertors to PyArg_ParseTuple... *do* overflow checking
Type: Stage:
Components: Documentation Versions: Python 3.6
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: docs@python Nosy List: Antony.Lee, docs@python, serhiy.storchaka
Priority: normal Keywords:

Created on 2018-03-09 00:47 by Antony.Lee, last changed 2022-04-11 14:58 by admin.

Messages (3)
msg313471 - (view) Author: Antony Lee (Antony.Lee) * Date: 2018-03-09 00:47
At https://docs.python.org/3/c-api/arg.html#numbers, it is explicitly documented that the unsigned number convertors do not perform overflow checking.  Implicitly, this suggests that the signed convertors *do* perform overflow checking, which they indeed do; but it would be nice to document this behavior explicitly (as overflow checking is not always expected of C-level functions).
msg313474 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2018-03-09 07:16
This doesn't look a good idea to me. It is implied that all checks are performed. For example it is implied that an error will be raised if the argument is of wrong type. I think that adding "with overflow checking" to every converting from a Python integer will just clutter the documentation.
msg313478 - (view) Author: Antony Lee (Antony.Lee) * Date: 2018-03-09 09:34
One could just add, immediately below the "Numbers" section, something like: "The signed convertors (b, h, i, ...) perform overflow checking.  The unsigned convertors (B, H, I, ...) do not."  That would actually be shorter than the current version, which repeats the second half for each unsigned entry...
History
Date User Action Args
2022-04-11 14:58:58adminsetgithub: 77214
2018-03-09 09:34:18Antony.Leesetmessages: + msg313478
2018-03-09 07:16:24serhiy.storchakasetnosy: + serhiy.storchaka
messages: + msg313474
2018-03-09 00:47:58Antony.Leecreate