Describe the bug
Please see this example.

The variable a used in [a for a in range(10)] is a local variable, which should not influence the variable a outside the expression.
The code:
a = dict(m=1)
arr = [a for a in range(10)]
a["m"]

Additionally, if we change the list comprehension to generator expression, there will be the same problem.
Code:
a = dict(m=1)
arr = (a for a in range(10))
a["m"]
VS Code extension or command-line
VS Code extension version 1.0.83
Thanks for the bug report. I'm able to repro the problem as reported. I understand the underlying cause and will work on a solution.
This will be fixed in the next release of pyright.
This is now fixed in 1.0.84, which I just published.