-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Exceptions from __init__() being caught #12505
Comments
I agree, but I haven't seen a good answer. |
It seems like it's sufficient to add a ETA: It also appears to work fine when the try/catch is removed entirely. |
@vtjnash, @timholy, @JeffBezanson – thoughts on this? |
I think there was some desire to prevent an exception in one module's However, when starting a standalone program, you would want an exception here to just exit(), so maybe it's fine to just remove the try/catch. |
Isn't it always dangerous to convert errors into warnings, even for completely third-party code? People will inevitably slip on fixing them and the bugs will get propagated much further than they should be. Would a possible fix be to allow |
+1 for removing the try/catch. If my module imports another module, and the latter module refuses to load, I'd like to halt unless I explicitly put the |
when importing another module, almost everything is an error (file not found, loading code causes an error, and now
that seems counter-intuitive, is rather hard to model in precompile, and goes against the general principle of avoiding warnings (and either making that something either fully allowed or fully disallowed) |
@vtjnash, yes, I wondered about that behavior when I saw it. An exception seems better, but I thought maybe there was some case with multiple modules in the same file where a warning might be intended? But I can't think of any concrete example of this at the moment. |
@vtjnash – I don't understand what your position is. Are you against removing the try/catch or for it? Or are you for it and in favor of making more things that can go wrong during |
i thought Jeff had a position that there should never be a case where emitting a warning is the intended behavior.
I think you fixed the order sufficiently so that this is not as much of a concern. When it was originally implemented, the list could contain unrelated modules so it was necessary to run through all of them, but with tkelman@506ecbe, i think it's safe to abort. to argue the other side, however, I sometimes (with invalid build trees), get errors during startup that some library couldn't be found (such as libgmp). It's currently rather nice that it is non-fatal (although only because I am not intending to use anything from that module). Brainstorming this further however, perhaps in the future, we could some sort of "stub" module that acts as a placeholder for a real module, but which actually holds an error. This might also potentially be an improvement for the following code (among others):
|
Was that commit merged? If not, then why not? |
That was from a funny rearranged branch I did for bisecting 10525, I'm pretty sure that commit's on master but has a different sha. |
An |
It was: 1047605. Good. |
Closed by #12576 |
Why is the exception caught and just a warning message printed? I did some basic searching but could not find any reference or explanation for this. Should I not have the ability to send an error to the top-level if something goes wrong when my module is being initialized?
The text was updated successfully, but these errors were encountered: