-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
[fix] AttributeError crash when a slice is used as a class decorator #10350
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?
[fix] AttributeError crash when a slice is used as a class decorator #10350
Conversation
68b72f9
to
49baeb3
Compare
1e5e8c1
to
d3c29cc
Compare
Closes pylint-dev#10334 Co-authored-by: codegen-sh[bot] <131295404+codegen-sh[bot]@users.noreply.github.com>
β¦corator" This reverts commit 49baeb3.
d3c29cc
to
754cfcb
Compare
Codecov ReportAll modified and coverable lines are covered by tests β
Additional details and impacted files@@ Coverage Diff @@
## main #10350 +/- ##
=======================================
Coverage 95.90% 95.90%
=======================================
Files 176 176
Lines 19122 19122
=======================================
Hits 18339 18339
Misses 783 783
π New features to boost your workflow:
|
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.
Pull Request Overview
This pull request fixes an AttributeError crash that occurred when a slice object was used as a class decorator. The changes include the addition of regression tests to reproduce the issue and adjustments in the Pylint checkers to prevent incorrect attribute access during inference.
Reviewed Changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated no comments.
File | Description |
---|---|
tests/functional/r/regression_02/regression_10334.txt | Adds expected test output indicating non-callable error. |
tests/functional/r/regression_02/regression_10334.py | Provides a test case using a slice as a decorator. |
pylint/checkers/utils.py | Updates attribute checks to safely verify presence of qname. |
pylint/checkers/deprecated.py | Adds a qname attribute check to avoid AttributeError. |
Files not reviewed (1)
- doc/whatsnew/fragments/10334.bugfix: Language not supported
π€ Effect of this PR on checked open source code: π€ Effect on django:
Effect on pandas:
This comment was generated for commit 8be5e62 |
Type of Changes
Description
This was partially implemented by an AI bot (codegen-bot), credited as co-author in the commit. I've done some chores (moving functional tests, fixing the new test, creating the changelog, checking that the changes are actually required and that the not required changes are not actually another crash), and some I did not (creating branches, it could have opened the PR if I wasn't working on a fork, creating the regression tests, making the initial fix). Tried to kept the history truthful to what happened. Overall not sure if it's more work or less work than just copy pasting the regression code and fixing myself (probably more), but it certainly feel new and exciting.
Suggestions on what to try next with this AI bot are welcome, I started with "noqa" handling but it seems a little too complicated. I probably should use this on task with less finesse and more grunt work, like refactor (?)
Closes #10334