-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Fix crash when a slice object is called
#10715
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
base: main
Are you sure you want to change the base?
Conversation
This comment has been minimized.
This comment has been minimized.
Codecov Reportβ
All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #10715 +/- ##
=======================================
Coverage 95.98% 95.98%
=======================================
Files 176 176
Lines 19540 19540
=======================================
Hits 18755 18755
Misses 785 785
π New features to boost your workflow:
|
prefer-typing-namedtuple and consider-math-not-float when a slice object is called.slice object is called
Pierre-Sassoulas
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's okay to pre-filter, maybe we don't have to filter anymore after that ? (It's not the first crash that the fuzzing caught by using slice instead of functiondev/classdef, maybe we can anticipate other instances of that without waiting for "random luck"). Maybe by creating a safe_infer_call function ?
pylint/extensions/code_style.py
Outdated
| if not called: | ||
| return |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| if not called: | |
| return | |
| if not (called and isinstance(called, (nodes.FunctionDef, nodes.ClassDef))): | |
| return |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point with the safe_infer_call, it seems that there are a number of usages where we infer call and access qname. I will put out a separate PR for that change.
This comment has been minimized.
This comment has been minimized.
|
π€ According to the primer, this change has no effect on the checked open source code. π€π This comment was generated for commit be9701c |
Type of Changes
Description
Add a runtime type guard before accessing
qname()on inferred called function for bothprefer-typing-namedtupleandconsider-math-not-floatchecks.Closes #10708