SyntaxError: iterable unpacking cannot be used in comprehension
Environment data
- VS Code version: 1.45.0-insider
- Extension version (available under the Extensions sidebar): 2020.4.74986
- OS and version: MacOS Mojave
- Python version (& distribution if applicable, e.g. Anaconda): 3.7.2, brew
- Type of virtual environment used (N/A | venv | virtualenv | conda | ...): none
- Jedi or Language Server? (i.e. what is
"python.jediEnabled"set to; more info microsoft/vscode-python#3977): either - Value of the
python.languageServersetting: Microsoft
Expected behaviour
def foo():
return ["bar", "baz"]
print([*foo() for _ in range(10)])
I would expect a red squiggle and syntax error to appear here, given at runtime it throws:
SyntaxError: iterable unpacking cannot be used in comprehension
Actual behaviour

You will need a linter to catch these:

Many of the builtin linters don't flag this (bandit, pycodestyle, pydocstyle). And I don't think users (many of whom may be just starting out with python and not even know what a linter is) should need to install additional tooling to protect against basic syntax errors.
And in my case I am using flake8 but for whatever reason it didn't flag it either:

Which means I had a very long running job fail at the last minute due to a syntax error.
I now appear to be in a state where I have linting enabled in .vscode/settings.json, but when I run 'Python : Run Linting' nothing at all happens and there is nothing written to the python output channel. When I run 'Python: Enable Linting', it shows 'off' and even when I select 'on' and enter the quick pick again it remains 'off'