Pyright: Variable used as a default value of an argument in a lambda expression is reported as not accessible

Created on 19 Jul 2020  路  2Comments  路  Source: microsoft/pyright

Describe the bug
var defined in a function scope in the screenshot below is accessed but reported as not.

To Reproduce
N/A

Expected behavior
N/A

Screenshots or Code
image

def test():
    var = 1


    lambda _=var: ...


# However, no error in the module scope
foo = 0
lambda _=foo: ...

VS Code extension or command-line
vim coc-pyright with pyright 1.1.53

Additional context
N/A

addressed in next version bug

Most helpful comment

This is now fixed in Pyright 1.1.54, which I just published. It will also be included in the next release of Pylance.

All 2 comments

Thanks for the bug report. This will be fixed in the next version of Pyright and Pylance.

This is now fixed in Pyright 1.1.54, which I just published. It will also be included in the next release of Pylance.

Was this page helpful?
0 / 5 - 0 ratings