Jeff Epler
13b13d1fdd
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 >
2025-01-26 22:54:58 +11:00
..
2023-04-27 18:03:06 +10:00
2023-06-08 17:54:24 +10:00
2023-06-08 17:54:24 +10:00
2023-06-08 17:54:24 +10:00
2023-06-08 17:54:24 +10:00
2023-06-08 17:54:24 +10:00
2023-06-08 17:54:24 +10:00
2023-06-08 17:54:24 +10:00
2023-03-09 12:13:12 +11:00
2023-03-09 12:13:12 +11:00
2022-12-16 11:44:10 +11:00
2022-12-16 11:44:10 +11:00
2023-06-08 17:54:24 +10:00
2023-06-08 17:54:24 +10:00
2023-07-13 13:50:50 +10:00
2023-07-13 13:50:50 +10:00
2021-05-30 10:38:48 +10:00
2023-06-08 17:54:24 +10:00
2023-06-08 17:54:24 +10:00
2020-02-11 11:06:17 +11:00
2023-10-13 15:29:09 +11:00
2023-06-08 17:54:24 +10:00
2024-02-20 12:12:28 +11:00
2023-06-08 17:54:24 +10:00
2020-02-28 12:45:36 +11:00
2023-05-19 12:35:12 +10:00
2024-08-19 14:18:34 +10:00
2024-08-19 14:18:34 +10:00
2024-07-25 12:27:33 +10:00
2024-04-22 11:50:52 +10:00
2024-04-22 11:50:52 +10:00
2024-04-22 11:50:52 +10:00
2024-01-05 15:08:33 +11:00
2023-06-08 17:54:24 +10:00
2023-06-08 17:54:24 +10:00
2024-04-22 11:50:52 +10:00
2023-06-08 17:54:24 +10:00
2023-06-08 17:54:24 +10:00
2019-10-29 22:22:37 +11:00
2016-07-22 12:02:04 +03:00
2016-07-22 12:02:04 +03:00
2023-06-08 17:54:24 +10:00
2014-05-15 19:09:06 +03:00
2023-06-08 17:54:24 +10:00
2023-06-08 17:54:24 +10:00
2019-10-29 22:22:37 +11:00
2024-05-28 10:58:37 +10:00
2024-05-28 10:58:37 +10:00
2016-07-25 14:45:08 +03:00
2019-10-29 22:22:37 +11:00
2014-09-23 14:15:45 +00:00
2015-01-13 16:21:23 +00:00
2017-06-10 20:03:01 +03:00
2014-12-24 20:28:30 +00:00
2014-12-24 20:28:30 +00:00
2024-05-28 10:58:37 +10:00
2014-01-19 18:41:55 +02:00
2015-08-21 12:02:09 +01:00
2020-06-30 23:55:32 +10:00
2024-10-16 15:03:30 +11:00
2014-07-05 06:14:29 +01:00
2019-10-29 22:22:37 +11:00
2019-12-27 12:53:36 +11:00
2023-06-08 17:54:24 +10:00
2023-05-19 13:44:00 +10:00
2023-06-08 17:54:24 +10:00
2014-03-16 15:18:22 +02:00
2014-07-05 06:14:29 +01:00
2014-01-21 23:48:04 +00:00
2024-03-18 14:10:14 +11:00
2024-11-04 11:22:43 +11:00
2024-03-19 10:08:32 +11:00
2024-03-19 10:08:32 +11:00
2024-03-18 14:10:14 +11:00
2014-06-03 12:53:44 +01:00
2023-06-08 17:54:24 +10:00
2014-04-06 21:31:42 +03:00
2023-05-19 12:06:17 +10:00
2015-01-11 15:13:18 +00:00
2023-06-08 17:54:24 +10:00
2023-06-08 17:54:24 +10:00
2023-10-09 09:46:02 +11:00
2023-10-09 09:46:02 +11:00
2017-04-05 10:52:29 +10:00
2014-01-19 18:41:55 +02:00
2014-01-19 18:41:55 +02:00
2014-07-05 06:14:29 +01:00
2024-05-27 13:56:55 +10:00
2024-05-27 13:56:55 +10:00
2024-06-21 16:23:08 +10:00
2024-05-27 13:56:55 +10:00
2024-05-27 13:56:55 +10:00
2024-05-27 13:56:55 +10:00
2020-01-27 13:16:06 +11:00
2024-06-21 16:23:08 +10:00
2024-05-27 13:56:55 +10:00
2025-01-26 22:54:58 +11:00
2023-06-08 17:54:24 +10:00
2024-03-07 16:25:17 +11:00
2024-03-07 16:25:17 +11:00
2024-03-07 16:25:17 +11:00
2024-03-07 16:25:17 +11:00
2024-03-07 16:25:17 +11:00
2024-07-01 13:52:59 +10:00
2024-07-01 13:52:59 +10:00
2024-03-07 16:25:17 +11:00
2024-03-07 16:25:17 +11:00
2024-03-07 16:25:17 +11:00
2024-06-24 14:07:00 +10:00
2024-06-24 14:07:00 +10:00
2024-09-02 14:15:49 +10:00
2024-09-02 14:15:49 +10:00
2024-06-24 14:07:00 +10:00
2015-10-01 22:48:48 +01:00
2023-06-01 15:11:06 +10:00
2023-06-08 17:54:24 +10:00
2023-05-19 12:35:12 +10:00
2023-06-08 17:54:24 +10:00
2023-06-08 17:54:24 +10:00
2023-06-08 17:54:24 +10:00
2023-06-08 17:54:24 +10:00
2023-06-08 17:54:24 +10:00
2023-06-08 17:54:24 +10:00
2023-06-08 17:54:24 +10:00
2023-06-08 17:54:24 +10:00
2014-01-19 18:41:55 +02:00
2015-11-17 14:00:14 +00:00
2025-01-26 22:54:58 +11:00
2023-05-19 13:44:00 +10:00
2014-01-19 18:41:55 +02:00
2017-12-20 16:58:27 +11:00
2023-06-08 17:54:24 +10:00
2023-06-08 17:54:24 +10:00
2023-06-08 17:54:24 +10:00
2023-06-08 17:54:24 +10:00
2023-06-08 17:54:24 +10:00
2015-04-04 22:05:30 +01:00
2023-06-08 17:54:24 +10:00
2015-04-04 22:05:30 +01:00
2023-06-08 17:54:24 +10:00
2023-06-08 17:54:24 +10:00
2025-01-26 22:51:50 +11:00
2023-05-19 13:33:54 +10:00
2023-06-08 17:54:24 +10:00
2023-06-08 17:54:24 +10:00
2019-12-13 14:20:47 +11:00
2023-06-08 17:54:24 +10:00
2015-03-12 22:48:45 +00:00
2016-09-30 14:20:55 +10:00
2015-03-12 22:48:45 +00:00
2020-02-11 11:06:17 +11:00
2016-09-28 11:10:27 +10:00
2014-04-07 05:00:03 +01:00
2014-04-07 05:00:03 +01:00
2023-11-21 22:28:57 +11:00
2024-05-28 10:50:57 +10:00
2024-05-28 10:50:57 +10:00
2023-06-01 13:01:07 +10:00
2023-06-01 13:01:07 +10:00
2023-06-01 13:01:07 +10:00
2024-05-28 10:58:37 +10:00
2023-06-08 17:54:24 +10:00
2015-01-30 00:27:46 +00:00
2017-08-29 00:06:21 +03:00
2024-05-28 10:58:37 +10:00
2024-05-28 10:58:37 +10:00
2022-01-19 15:34:32 +11:00
2024-09-26 23:39:06 +10:00
2023-09-01 14:31:57 +10:00
2020-01-24 10:57:17 +11:00
2024-05-28 10:58:37 +10:00
2024-05-28 10:58:37 +10:00
2024-06-06 17:34:28 +10:00
2014-05-31 07:30:57 +01:00
2017-03-07 16:48:16 +11:00
2023-05-19 13:44:00 +10:00
2015-04-12 00:17:57 +03:00
2017-09-19 21:21:12 +03:00
2014-05-10 19:49:07 +03:00
2023-06-08 17:54:24 +10:00
2023-09-01 14:50:49 +10:00
2023-06-08 17:54:24 +10:00
2023-06-08 17:54:24 +10:00
2023-06-08 17:54:24 +10:00
2017-09-01 10:10:51 +10:00
2024-07-25 13:07:42 +10:00
2020-01-30 14:53:07 +11:00
2014-07-05 06:14:29 +01:00
2023-06-08 17:54:24 +10:00
2023-06-08 17:54:24 +10:00
2024-10-07 11:37:52 +11:00
2023-12-15 11:43:39 +11:00
2023-06-08 17:54:24 +10:00
2023-06-08 17:54:24 +10:00
2023-06-08 17:54:24 +10:00
2024-09-06 17:00:35 +10:00
2024-09-06 17:00:35 +10:00
2024-09-06 17:00:35 +10:00
2023-06-08 17:54:24 +10:00
2023-06-08 17:54:24 +10:00
2014-01-19 18:41:55 +02:00
2014-01-19 18:41:55 +02:00
2014-01-19 18:41:55 +02:00
2016-02-01 16:07:21 +00:00
2019-02-21 16:22:41 +11:00
2015-03-25 23:10:09 +00:00
2019-09-02 13:30:16 +10:00
2019-10-04 23:01:29 +10:00
2024-01-31 12:56:29 +11:00
2017-08-09 21:20:42 +10:00
2014-04-17 16:21:43 +01:00
2014-01-19 18:41:55 +02:00
2015-03-12 22:48:45 +00:00
2014-07-05 06:14:29 +01:00