Heikki's draft commit message addresses that point:
The old implementation accepted trailing whitespace, but that seemed unnecessary. Firstly, its sibling function for parsing decimals, strtodouble(), does not accept trailing whitespace. Secondly, none of the callers can pass a string with trailing whitespace to it.
My mistake – Heikki is absolutely right.
Looking at the two call sites of the function: one filters out trailing spaces within the 'is_an_int' function, and the other in exprscan.l won’t pass strings with trailing spaces either.
I didn't try to verify the latter assertion, but if it's true, we don't need the extra complication.