[issue33305] Improve syntax error for numbers with leading zero

2018-07-09 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker ___

[issue33305] Improve syntax error for numbers with leading zero

2018-07-09 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: New changeset cf7303ed2aa19fb48687d7140dbc86fc23c9fca4 by Serhiy Storchaka in branch 'master': bpo-33305: Improve SyntaxError for invalid numerical literals. (GH-6517) https://github.com/python/cpython/commit/cf7303ed2aa19fb48687d7140dbc86fc23c9fca4

[issue33305] Improve syntax error for numbers with leading zero

2018-04-25 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: In Python 2.5 `0or[]` is valid syntax, but it is not valid in newer versions. What is the good error message for this case? -- ___ Python tracker

[issue33305] Improve syntax error for numbers with leading zero

2018-04-18 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: PR 6517 improves syntax error messages for invalid numerical literals. >>> 012 File "", line 1 SyntaxError: leading zeros in decimal integer literals are not permitted; use an 0o prefix for octal integers >>> 0o129 File "",

[issue33305] Improve syntax error for numbers with leading zero

2018-04-18 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- keywords: +patch pull_requests: +6210 stage: -> patch review ___ Python tracker ___

[issue33305] Improve syntax error for numbers with leading zero

2018-04-18 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: It still can cause when copy octal constants from other languages or from old Python 2 books and articles. Perhaps it should emit SyntaxWarning if all digits are in range 0-7 and the number is larger than 7. -- nosy:

[issue33305] Improve syntax error for numbers with leading zero

2018-04-18 Thread Mark Dickinson
Mark Dickinson added the comment: For the message: > invalid token, use 0o prefix for octal integers I'd expect (without having any evidence to back this up) that the majority of people who encounter this error would be those who intended a decimal literal rather than an

[issue33305] Improve syntax error for numbers with leading zero

2018-04-18 Thread Mark Dickinson
Mark Dickinson added the comment: Maybe once Python 2.7 officially reaches EOL, we can remove the syntax error altogether and allow leading zeros on decimal integer literals. -- nosy: +mark.dickinson ___ Python tracker

[issue33305] Improve syntax error for numbers with leading zero

2018-04-17 Thread Steven D'Aprano
Change by Steven D'Aprano : -- type: behavior -> enhancement ___ Python tracker ___

[issue33305] Improve syntax error for numbers with leading zero

2018-04-17 Thread Steven D'Aprano
New submission from Steven D'Aprano : The Python 2.x syntax for octal integers is a syntax error in 3.x, but the error message is very uninformative: SyntaxError: invalid token Can this be improved? Perhaps to something like: invalid token, use 0o prefix for