gh-158072: Fix JIT crash with omitted default arguments - #158128
Conversation
|
Thanks. I can confirm that it fixes my original crash as well. |
7c7e6c3 to
209cd64
Compare
| } | ||
|
|
||
| // Initialize with the initial state of all local variables | ||
| for (int i = 0; i < arg_len; i++) { |
There was a problem hiding this comment.
If __init__.__code__ changes, this can still produce incorrect results. So we can limit arg_len to co->co_argcount before this loop.
| arg_len = Py_MIN(arg_len, co->co_argcount); | |
| for (int i = 0; i < arg_len; i++) { |
And we need a new test for this (or implement it in other PR)
There was a problem hiding this comment.
Oh, I didn't think about that! Done in 689e8e7
cocolato
left a comment
There was a problem hiding this comment.
LGTM, and let's wait a core dev to review this
|
Great, thanks for the fast review and merge! Should we also backport this to 3.15, since the original report was for 3.15 or would you rather only keep it for 3.16? |
|
Yes, please. 3.16 is still long way ahead, and 3.15 is the primary target I'm testing JIT on. |
|
Thanks @lgeiger for the PR, and @markshannon for merging it 🌮🎉.. I'm working now to backport this PR to: 3.15. |
|
GH-158543 is a backport of this pull request to the 3.15 branch. |
This fixes a JIT crash when a class is called without passing an optional
__init__argument. The optimizer treated that argument as uninitialized, even though Python fills it from a default.I've verified that change fixes #158072 on my machine. I'm not a JIT expert and this fix was developed with significant LLM help so review with care 😇
starlettetest suite, whenbrotliis installed #158072