-
-
Notifications
You must be signed in to change notification settings - Fork 31.7k
Instance attr error suggestions can execute __getattr__
#132385
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
Comments
I am ok being more defensive but this is a known limitation in general and was discussed plenty of times. If users create an object with known unwanted effects on things like |
You meant except AttributeError? Hmm, why? Accordingly to the docs, the dunder method in example is broken. But I doubt we should silently hide this from the end user. The SystemExit is a special snowflake: no traceback will be printed. But I think that the example is slightly artificial in using that specific exception. With a different you will got something more meaningful. Well, when issues like #129605 will be fixed in the new REPL;-) |
@pablogsal yes, I understand that and agree. But, I think that error suggestions are a bit unique here. Because most of the time Here's the demo of the difference between a regular 2025-04-11.13.36.02.movAnd a side-effect which terminates the whole REPL: 2025-04-11.13.35.29.movI propose to fix the second behavior. |
Yeah I am not against fixing the second behaviour I am just being cautious of not trying to go crazy and promise things that would complicate or restrict everything |
KeyboardInterrupt comes from the system, not from the object. |
It's true, it was a very contrived example. A far more likely scenario would be a Would it make sense to use an attribute lookup strategy more like |
|
Yeah, but this is not because someone would override stuff but because someone sent the signal no?
This is precisely what I meant: if the user is implementing that behavior then is up to them, we should not try to protect anything here or we will be drowning in complexity. |
(sorry, I thought that the error was at the interpreter's level but it's more in |
Bug report
Originally found by @millerdev in #99140 (comment)
I think that this is not ideal. We probably want to silence all errors. I have a PR ready.
Linked PRs
traceback
#132387The text was updated successfully, but these errors were encountered: