[New-bugs-announce] [issue44317] Misleading mark of octal SyntaxErrors

wyz23x2 report at bugs.python.org
Sat Jun 5 07:01:10 EDT 2021


New submission from wyz23x2 <wyz23x2 at 163.com>:

Python 3.10.0b2 (tags/v3.10.0b2:3173141, Jun  1 2021, 09:05:29) [MSC v.1928 64 bit (AMD64)] on win32 
Type "help", "copyright", "credits" or "license" for more information.
>>> 0777
  File "<stdin>", line 1
    0777
       ^
SyntaxError: leading zeros in decimal integer literals are not permitted; use an 0o prefix for octal integers
>>> 000123
  File "<stdin>", line 1
    000123
         ^
SyntaxError: leading zeros in decimal integer literals are not permitted; use an 0o prefix for octal integers

The ^ is placed below the last digit.
However, this is misleading. The error is "leading zeros" and "prefix". So I would expect this:

>>> 0777
  File "<stdin>", line 1
    0777
    ^
SyntaxError: leading zeros in decimal integer literals are not permitted; use an 0o prefix for octal integers
>>> 000123
  File "<stdin>", line 1
    000123
    ^^^
SyntaxError: leading zeros in decimal integer literals are not permitted; use an 0o prefix for octal integers

Opinions?

----------
components: Parser
messages: 395161
nosy: lys.nikolaou, pablogsal, wyz23x2
priority: normal
severity: normal
status: open
title: Misleading mark of octal SyntaxErrors
type: behavior
versions: Python 3.10, Python 3.11

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue44317>
_______________________________________


More information about the New-bugs-announce mailing list