Thanks to visit codestin.com
Credit goes to github.com

Skip to content

CPython does not admit leading 0 in ints without an o or [xX] #2002

Closed
@rebcabin

Description

@rebcabin

repro:

    assert 07 == 7
    assert 08 == 8

CPython throws, but LPython admits them

(lp) ┌─(~/CLionProjects/lpython/lasr/LP-pycharm)─────────────────────────────────────────────────────────────────────────────────────────────────────────(brian@Golf37:s012)─┐
└─(10:12:25 on brian-lasr ✹ ✭)──> PYTHONPATH='../../src/runtime/lpython' python lasr_lexer.py                                                             ──(Thu,Jun22)─┘
  File "/Users/brian/CLionProjects/lpython/lasr/LP-pycharm/lasr_lexer.py", line 234
    assert 07 == 7
           ^
SyntaxError: leading zeros in decimal integer literals are not permitted; use an 0o prefix for octal integers

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions