Skip to content

AttributeError: 'Lambda' object has no attribute 'bases' in exceptions checker #10106

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

Closed
correctmost opened this issue Dec 3, 2024 · 0 comments · Fixed by #10232
Closed

AttributeError: 'Lambda' object has no attribute 'bases' in exceptions checker #10106

correctmost opened this issue Dec 3, 2024 · 0 comments · Fixed by #10232
Labels
Backported Crash 💥 A bug that makes pylint crash Needs PR This issue is accepted, sufficiently specified and now needs an implementation
Milestone

Comments

@correctmost
Copy link
Contributor

correctmost commented Dec 3, 2024

Bug description

Pylint crashes on this fuzzed code from pysource-codegen:

e = lambda x: 1, 2

try:
    pass
except e:
    pass

Configuration

Command used

pylint crash.py

Pylint output

Exception on node <Try l.3 at 0x7fea43cf8a10> in file 'pylint/crash.py'
Traceback (most recent call last):
  File "pylint/pylint/utils/ast_walker.py", line 87, in walk
    callback(astroid)
  File "pylint/pylint/checkers/exceptions.py", line 609, in visit_try
    self._check_catching_non_exception(handler, exception, part)
  File "pylint/pylint/checkers/exceptions.py", line 433, in _check_catching_non_exception
    if all(
       ^^^^
  File "pylint/pylint/checkers/exceptions.py", line 435, in <genexpr>
    and (utils.inherit_from_std_ex(node) or not utils.has_known_bases(node))
                                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "pylint/pylint/checkers/utils.py", line 1471, in has_known_bases
    for base in klass.bases:
                ^^^^^^^^^^^
AttributeError: 'Lambda' object has no attribute 'bases'

Expected behavior

No crash

Pylint version

pylint: 55098c7
astroid: cae4388d75
Python 3.12.7

OS / Environment

Arch Linux

Additional dependencies

@correctmost correctmost added the Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling label Dec 3, 2024
@Pierre-Sassoulas Pierre-Sassoulas added Crash 💥 A bug that makes pylint crash Needs PR This issue is accepted, sufficiently specified and now needs an implementation and removed Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling labels Dec 5, 2024
ChandanChainani added a commit to ChandanChainani/pylint that referenced this issue Feb 13, 2025
ChandanChainani added a commit to ChandanChainani/pylint that referenced this issue Feb 13, 2025
@jacobtylerwalls jacobtylerwalls added this to the 3.3.5 milestone Feb 15, 2025
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
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants