Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork8.1k
MNT: make _setattr_cm more conservative#17620
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
MNT: make _setattr_cm more conservative#17620
Uh oh!
There was an error while loading.Please reload this page.
Conversation
QuLogic commentedJun 11, 2020
CI does not like this at all. |
tacaswell commentedJun 11, 2020
Indeed, I thought I ran the tests before I pushed. I must have lost track of what I was doing locally... |
4111ab6 tod0849a6Comparetacaswell commentedJun 11, 2020
🤦 I edited one working tree and installed and tested a different one. |
d0849a6 to3b4da04Compare
QuLogic 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.
Not sure what features we should be supporting in the future (re:#17561), but at least this makes it clear what we don't.
Uh oh!
There was an error while loading.Please reload this page.
lib/matplotlib/cbook/__init__.py Outdated
| origs= {} | ||
| forattrinkwargs: | ||
| orig=getattr(obj,attr,sentinel) | ||
| # monkey patching on a new attribute, this is OK |
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.
perhaps you can reorder this to make the common case first, e.g.
if (attr in obj.__dict__ or orig is sentinel or isinstance(getattr(type(obj), attr), (property, types.FunctionType)): origs[attr] = origelse: raise ValueError(...)Checking to types.FunctionType in the type is the same as checking for methods, and (as noted in the other PR, I think) won't give a wrong result if an unrelated bound method is assigned as instance var (self.foo = otherobj.method) -- at least I think this point should be fixed.
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.
That makes sense. I agree the method from another object is a valid concern (sorry I didn't fully register it before).
6ee399a to756b9c3CompareUh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
anntzer 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.
just style things.
- special case methods and properties because they are descriptors - fail on any other non-instance attribute
756b9c3 to9e88fa5Compare
PR Summary
This is a simpler version of#17561
PR Checklist