[issue44317] Problems of int literal SyntaxErrors

wyz23x2 report at bugs.python.org
Sat Jun 5 14:50:44 EDT 2021


wyz23x2 <wyz23x2 at 163.com> added the comment:

Another 2 problems:
1.
>>> 0b1112
  File "<stdin>", line 1
    0b1112
         ^
SyntaxError: invalid digit '2' in binary literal
>>> 0o5780
  File "<stdin>", line 1
    0o5780
        ^
SyntaxError: invalid digit '8' in octal literal
But:
>>> 0x2fag
  File "<stdin>", line 1
    0x2fag
    ^^^^^^
SyntaxError: invalid syntax. Perhaps you forgot a comma?
>>> 
Is this expected?

2.
>>> 0o91
  File "<stdin>", line 1
    0o91
     ^
SyntaxError: invalid digit '9' in octal literal
>>> 0b21
  File "<stdin>", line 1
    0b21
     ^
SyntaxError: invalid digit '2' in binary literal

The ^ is misplaced again, even though, say the 0b1112 example above works.

----------
title: Misleading mark of octal SyntaxErrors -> Problems of int literal SyntaxErrors

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


More information about the Python-bugs-list mailing list