Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Backport maintenance/3.2.x] Fix crash in refactoring checker when calling bound lambda #9867

Commits on Aug 11, 2024

  1. Fix crash in refactoring checker when calling bound lambda

    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 pylint-dev#9865
    
    (cherry picked from commit b78deb6)
    Hnasar authored and jacobtylerwalls committed Aug 11, 2024
    Configuration menu
    Copy the full SHA
    930ad78 View commit details
    Browse the repository at this point in the history