Fix assigning-non-slot false positive with setattr#5457
Conversation
Previously, if a class was slotted and overrode `__setattr__`, `assigning-non-slot` would be issued when assigning to attributes. With `__setattr__` defined, we cannot infer if it is an error to assign to an attribute, so we suppress the error. Fix pylint-dev#3793
Pull Request Test Coverage Report for Build 1583001355
💛 - Coveralls |
|
I've fixed the merge conflict in |
|
Thank you ! There will be a lot of conflicts with the first other MR being merged in main (there's only one place to put the changelog right now so conflicts are inevitable), please be mindful of your time and wait for a first review before rebasing again 😄 (also it helps with saving runner so other MR get checked faster) |
|
Ah sure, no problem! |
Pierre-Sassoulas
left a comment
There was a problem hiding this comment.
It look like the fix was indeed simpler than anticipated at first. Thank you for the very straightforward fix ! Small change-set, well tested, and a proper changelog 👌
DanielNoord
left a comment
There was a problem hiding this comment.
Small change to fix the changelog. Rest looks good to me, thanks!
|
Thanks for the quick turnaround @jakelishman! |
|
Congratulation on becoming a contributor too 😉 |
|
Thanks! I've used pylint a lot through general development, so it's nice I finally had a chance to give something back to it, no matter how small! |
doc/whatsnew/<current release.rst>.Type of Changes
Description
Previously, if a class was slotted and overrode
__setattr__,assigning-non-slotwould be issued when assigning to attributes. With__setattr__defined, we cannot infer if it is an error to assign to anattribute, so we suppress the error.
Fix #3793
I came across that same behaviour in Qiskit/qiskit#7347, and found the old issue #3793 describing it. That's marked "high effort" whereas this is a very simple patch, so apologies if I've missed some complicating circumstances here.