PyCQA / flake8

flake8 is a python tool that glues together pycodestyle, pyflakes, mccabe, and third-party plugins to check the style and quality of some python code.
https://flake8.pycqa.org
Other
3.39k stars 306 forks source link

flake8-commas incompatible with Python 3.12 #1929

Closed sanromeo closed 4 months ago

sanromeo commented 5 months ago

how did you install flake8?

pip install flake8==6.1.0
pip install flake8-commas

unmodified output of flake8 --bug-report

{
  "platform": {
    "python_implementation": "CPython",
    "python_version": "3.12.1",
    "system": "Darwin"
  },
  "plugins": [
    {
      "plugin": "flake8-commas",
      "version": "2.1.0"
    },
    {
      "plugin": "mccabe",
      "version": "0.7.0"
    },
    {
      "plugin": "pycodestyle",
      "version": "2.11.1"
    },
    {
      "plugin": "pyflakes",
      "version": "3.1.0"
    }
  ],
  "version": "6.1.0"
}

describe the problem

what I expected to happen

No error

what happened

When I just run flake8 t.py with flake8, flake8-commas pre-installed it fails

Traceback (most recent call last):
  File "/Users/roman.korsun/.pyenv/versions/3.12.1/bin/flake8", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/Users/roman.korsun/.pyenv/versions/3.12.1/lib/python3.12/site-packages/flake8/main/cli.py", line 23, in main
    app.run(argv)
  File "/Users/roman.korsun/.pyenv/versions/3.12.1/lib/python3.12/site-packages/flake8/main/application.py", line 198, in run
    self._run(argv)
  File "/Users/roman.korsun/.pyenv/versions/3.12.1/lib/python3.12/site-packages/flake8/main/application.py", line 187, in _run
    self.run_checks()
  File "/Users/roman.korsun/.pyenv/versions/3.12.1/lib/python3.12/site-packages/flake8/main/application.py", line 103, in run_checks
    self.file_checker_manager.run()
  File "/Users/roman.korsun/.pyenv/versions/3.12.1/lib/python3.12/site-packages/flake8/checker.py", line 238, in run
    self.run_serial()
  File "/Users/roman.korsun/.pyenv/versions/3.12.1/lib/python3.12/site-packages/flake8/checker.py", line 221, in run_serial
    ).run_checks()
      ^^^^^^^^^^^^
  File "/Users/roman.korsun/.pyenv/versions/3.12.1/lib/python3.12/site-packages/flake8/checker.py", line 526, in run_checks
    self.run_ast_checks()
  File "/Users/roman.korsun/.pyenv/versions/3.12.1/lib/python3.12/site-packages/flake8/checker.py", line 428, in run_ast_checks
    for line_number, offset, text, _ in runner:
  File "/Users/roman.korsun/.pyenv/versions/3.12.1/lib/python3.12/site-packages/flake8_commas/_base.py", line 333, in run
    for error in get_comma_errors(tokens):
  File "/Users/roman.korsun/.pyenv/versions/3.12.1/lib/python3.12/site-packages/flake8_commas/_base.py", line 306, in get_comma_errors
    (token.type == COLON and stack[-1].comma == LAMBDA_EXPR)
                             ~~~~~^^^^
IndexError: list index out of range

...

sample code

print('hello world!')

commands ran

$ flake8 t.py
...
sigmavirus24 commented 4 months ago

flake8-commas is a separate plugin and as the issue template and new issue flow explicitly describe- plugin bug reports do not belong here.