-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Crash from refactoring checker when BoundMethod being called is a lambda #9865
Labels
Backported
Crash 💥
A bug that makes pylint crash
Needs PR
This issue is accepted, sufficiently specified and now needs an implementation
Milestone
Comments
Hnasar
added a commit
to Hnasar/pylint
that referenced
this issue
Aug 11, 2024
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
jacobtylerwalls
added
Crash 💥
A bug that makes pylint crash
Needs PR
This issue is accepted, sufficiently specified and now needs an implementation
labels
Aug 11, 2024
jacobtylerwalls
pushed a commit
that referenced
this issue
Aug 11, 2024
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
jacobtylerwalls
pushed a commit
to jacobtylerwalls/pylint
that referenced
this issue
Aug 11, 2024
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)
jacobtylerwalls
pushed a commit
that referenced
this issue
Aug 11, 2024
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)
jacobtylerwalls
added a commit
that referenced
this issue
Aug 11, 2024
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>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Backported
Crash 💥
A bug that makes pylint crash
Needs PR
This issue is accepted, sufficiently specified and now needs an implementation
Bug description
When parsing the following
a.py
:Command used
Pylint output
pylint crashed with a ``AstroidError`` and with the following stacktrace:
Expected behavior
No crash.
Pylint version
OS / Environment
linux (Linux)
Additional dependencies
The text was updated successfully, but these errors were encountered: