gh-132732: Clear errors in JIT optimizer on error#136048
gh-132732: Clear errors in JIT optimizer on error#136048Fidget-Spinner merged 7 commits intopython:mainfrom
Conversation
|
Asking just to educate myself: what kind of errors are we expecting inside the JIT and is it safe to always clear them? |
|
In general, we want to shift as much computation as possible to optimization-time instead of runtime. Some classes of errors, like The other class of errors are ones that are easier to ask forgiveness than permission for. For example, constant-evaluating stuff like |
Python/optimizer_analysis.c
Outdated
| if (PyErr_Occurred()) { | ||
| PyErr_Clear(); | ||
| } |
There was a problem hiding this comment.
Shouldn't this be:
| if (PyErr_Occurred()) { | |
| PyErr_Clear(); | |
| } | |
| assert(PyErr_Occurred()); | |
| PyErr_Clear(); |
...or are there cases where an error hasn't occurred, but we end up here?
There was a problem hiding this comment.
I think the current code goes to error on some cases where we run out of memory too, but no memoryerror is set.
There was a problem hiding this comment.
I don't think so, all uses of goto error in these files seem like they have an error set.
|
@tomasr8 may I trouble you with a review please? |
tomasr8
left a comment
There was a problem hiding this comment.
Given Brandt's explanation, this looks good to me :) I just left one question/comment
Uh oh!
There was an error while loading. Please reload this page.