Skip to content

Commit

Permalink
Handle the case where node is a Module in brain_builtin_inference
Browse files Browse the repository at this point in the history
  • Loading branch information
Pierre-Sassoulas committed Jul 9, 2021
1 parent 2dd9027 commit eb41df3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 2 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ What's New in astroid 2.6.3?
============================
Release date: TBA

* Fix a crash when the node is a 'Module' in the brain builtin inference

Closes PyCQA/pylint#4671

What's New in astroid 2.6.2?
============================
Expand Down
4 changes: 3 additions & 1 deletion astroid/brain/brain_builtin_inference.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,9 @@ def _transform_wrapper(node, context=None):

if result.lineno is None:
result.lineno = node.lineno
if result.col_offset is None:
# Can be a 'Module' see https://github.com/PyCQA/pylint/issues/4671
# We don't have a regression test on this one: tread carefully
if hasattr(result, "col_offset") and result.col_offset is None:
result.col_offset = node.col_offset
return iter([result])

Expand Down

0 comments on commit eb41df3

Please sign in to comment.