[issue29146] Confusing "invalid token" exception when integers have leading zero

New submission from John Parejko: As described in PEP-3127, the "leading-zeros" formatting for octal was removed from python 3. This is a good thing(tm), but the recommendation of that PEP to improve the error message of the raised exception[1] was apparently never implemented. I just ran into this while with some recently-ported python2 code, and it took a while to figure out the problem. Although this is going to be less of a problem with time as people convert to pure python3, it will be very helpful during the transition period.
0o007 7 007 File "<stdin>", line 1 007 ^ SyntaxError: invalid token
1: https://www.python.org/dev/peps/pep-3127/#id17 ---------- assignee: docs@python components: 2to3 (2.x to 3.x conversion tool), Documentation, Interpreter Core messages: 284591 nosy: John Parejko, docs@python priority: normal severity: normal status: open title: Confusing "invalid token" exception when integers have leading zero type: behavior versions: Python 3.5 _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue29146> _______________________________________

John Parejko added the comment: Ah, I finally found a related issue, and it looks like it has patches! https://bugs.python.org/issue20608 If someone could check that over and merge it, that would be wonderful! ---------- _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue29146> _______________________________________
participants (1)
-
John Parejko