Skip to content

Commit ded9372

Browse files
(fix) pylint-dev#10106 AttributeError lambda variable as exception
1 parent 5c6950c commit ded9372

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

doc/whatsnew/fragments/10106.breaking

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Fix AttributeError: 'Lambda' object has no attribute 'bases' in exceptions checker
2+
3+
Closes #10106

pylint/checkers/exceptions.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,7 @@ def _check_catching_non_exception(
432432
return
433433
if all(
434434
node
435-
and (utils.inherit_from_std_ex(node) or not utils.has_known_bases(node))
435+
and (utils.inherit_from_std_ex(node) or (isinstance(node, nodes.ClassDef) and not utils.has_known_bases(node)))
436436
for node in inferred
437437
):
438438
return

0 commit comments

Comments
 (0)