Author josh.r
Recipients Cryvate, Rosuav, cryvate, docs@python, josh.r, rfk
Date 2021-06-18.04:13:41
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
The description is nonsensical as is; not sure the patch goes far enough. C-style strings are *defined* to end at the NUL terminator; if it really needs a NUL after the int, saying it "points to the first character which follows the representation of the number" is highly misleading; the NUL isn't logically a character in the C-string way of looking at things.

The patch is also wrong; the digits need not end in a NUL byte (trailing whitespace is allowed).

AFAICT, the function really uses pend for two purposes:

1. If it succeeds in parsing, then pend reports the end of the string, nothing else
2. If it fails, because the string is not a legal input (contains non-numeric, or non-leading/terminal whitespace or whatever), pend tells you where the first violation character that couldn't be massaged to meet the rules for int() occurred.

#1 is a mostly useless bit of info (strlen would be equally informative, and if the value parsed, you rarely care how long it was anyway), so pend is, practically speaking, solely for error-checking/reporting.

The rewrite should basically say what is allowed (making it clear anything beyond the single parsable integer value with optional leading/trailing whitespace is illegal), and making it clear that pend always points to the end of the string on success (not just after the representation of the number, it's after the trailing whitespace too), and on failure indicates where parsing failed.
Date User Action Args
2021-06-18 04:13:42josh.rsetrecipients: + josh.r, rfk, docs@python, Rosuav, Cryvate, cryvate
2021-06-18 04:13:42josh.rsetmessageid: <>
2021-06-18 04:13:42josh.rlinkissue14995 messages
2021-06-18 04:13:41josh.rcreate