Commit f1925f4
Fix crash in refactoring checker when calling bound lambda (#9867)
Fixes:
```
File "sources/pylint/pylint/checkers/refactoring/refactoring_checker.py", line 2094, in _is_function_def_never_returning
and node.returns
^^^^^^^^^^^^
File "sources/pylint/.venv/lib/python3.11/site-packages/astroid/bases.py", line 138, in __getattr__
return getattr(self._proxied, name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'Lambda' object has no attribute 'returns'
```
Crash is reproducible if you have something like this:
```python
class C:
eq = lambda self, y: self == y
```
As a workaround, use a normal function instead of a lambda.
Closes #9865
(cherry picked from commit b78deb6)
Co-authored-by: Hashem Nasarat <hashem@hudson-trading.com>1 parent 7d1626c commit f1925f4
File tree
3 files changed
+23
-7
lines changed- doc/whatsnew/fragments
- pylint/checkers/refactoring
- tests/functional/r/regression
3 files changed
+23
-7
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2083 | 2083 | | |
2084 | 2084 | | |
2085 | 2085 | | |
2086 | | - | |
2087 | | - | |
2088 | | - | |
2089 | | - | |
2090 | | - | |
2091 | | - | |
2092 | | - | |
| 2086 | + | |
| 2087 | + | |
| 2088 | + | |
| 2089 | + | |
| 2090 | + | |
| 2091 | + | |
| 2092 | + | |
| 2093 | + | |
| 2094 | + | |
| 2095 | + | |
| 2096 | + | |
| 2097 | + | |
2093 | 2098 | | |
2094 | 2099 | | |
2095 | 2100 | | |
| |||
Lines changed: 8 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
0 commit comments