Skip to content

Remove unnecessary try...except from frame() call #5664

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

Merged
merged 1 commit into from
Feb 2, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions pylint/checkers/classes/class_checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -1660,10 +1660,7 @@ def _check_protected_attribute_access(self, node: nodes.Attribute):
@staticmethod
def _is_called_inside_special_method(node: nodes.NodeNG) -> bool:
"""Returns true if the node is located inside a special (aka dunder) method"""
try:
frame_name = node.frame(future=True).name
except AttributeError:
return False
frame_name = node.frame(future=True).name
return frame_name and frame_name in PYMETHODS

def _is_type_self_call(self, expr):
Expand Down