Skip to content

3.12+: TokenError no longer raised for some invalid source (mismatched braces?) #105714

Closed as not planned
@asottile

Description

@asottile

this comes from the pycodestyle testsuite -- I expect the tokenizer to raise an error for this however it seems to silently accept it now.

Bug report

yep, this is just a single curly brace

}
$ python3.11 -m tokenize t.py
t.py:2:0: error: EOF in multi-line statement
$ python3.12 -m tokenize t.py
0,0-0,0:            ENCODING       'utf-8'        
1,0-1,1:            OP             '}'            
1,1-1,2:            NEWLINE        '\n'           
2,0-2,0:            ENDMARKER      '' 

Your environment

  • CPython versions tested on: d310fc7
  • Operating system and architecture: ubuntu 22.04 x86_64

Metadata

Metadata

Labels

3.12only security fixes3.13bugs and security fixestype-bugAn unexpected behavior, bug, or error

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions