summaryrefslogtreecommitdiff
path: root/py/objstr.c
diff options
context:
space:
mode:
authorJeff Epler <jepler@gmail.com>2024-01-03 19:31:35 -0600
committerDamien George <damien@micropython.org>2025-01-26 22:54:58 +1100
commit13b13d1fdd05549d504eeded0b5aa8871d5e5dcf (patch)
tree0cd66eb9e2e2cb2ca0c6904c0093bf59ed77c1cb /py/objstr.c
parent7b3f189b1723fe642f122a3b7826d16fe32f801a (diff)
py/parsenum: Throw an exception for invalid int literals like "01".
This includes making int("01") parse in base 10 like standard Python. When a base of 0 is specified it means auto-detect based on the prefix, and literals begining with 0 (except when the literal is all 0's) like "01" are then invalid and now throw an exception. The new error message is different from CPython. It says e.g., `SyntaxError: invalid syntax for integer with base 0: '09'` Additional test cases were added to cover the changed & added code. Co-authored-by: Damien George <damien@micropython.org> Signed-off-by: Jeff Epler <jepler@gmail.com>
Diffstat (limited to 'py/objstr.c')
0 files changed, 0 insertions, 0 deletions