blob: f23a170d10e7c9dbc3a1dbd5408fe9ca67a7230b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
# pylint: disable=missing-module-docstring, missing-docstring
# pylint: disable=invalid-name
# These trigger the bug
def lambda_with_args():
variable = 1
return lambda *_, variable=variable: variable + 1
def lambda_with_args_kwargs():
variable = 1
return lambda *_, variable=variable, **_kwargs: variable + 1
def lambda_with_args_and_multi_args():
variable = 1
return lambda *_, a, variable=variable: variable + a
# The rest of these do not trigger the bug
def lambda_with_multi_args():
variable = 1
return lambda a, variable=variable: variable + a
def lambda_without_args():
variable = 1
return lambda variable=variable: variable + 1
def lambda_with_kwargs():
variable = 1
return lambda variable=variable, **_: variable + 1
def func_def():
variable = 1
def f(*_, variable=variable):
return variable + 1
return f
def different_name():
variable = 1
return lambda *args, var=variable: var + 1
|