Commit d41f4fc
Fix generator exception state setup on deopt in Python 3.15
Summary:
In Python 3.15, generator expressions may include bytecodes before `RETURN_GENERATOR` that can raise exceptions (e.g., `GET_ITER` on a non-iterable). When the JIT deopts due to such an exception, the interpreter expects `tstate->exc_info` to point to the generator's exception state for generator frames.
This change adds code in `resumeInInterpreter()` to properly link the exception state before calling `_PyEval_EvalFrame()`. We only set this
up if not already configured (to avoid conflicts with `jitgen_am_send` which may have already set it up). The interpreter's `clear_gen_frame()` handles restoring the previous exception state, so no cleanup is needed after `_PyEval_EvalFrame()` returns.
Reviewed By: DinoV
Differential Revision: D91188235
fbshipit-source-id: 4d3b51ab37d8d207162dc1b3f96d70c43f4d77261 parent 19b2af5 commit d41f4fc
1 file changed
Lines changed: 18 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
351 | 351 | | |
352 | 352 | | |
353 | 353 | | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
354 | 372 | | |
355 | 373 | | |
356 | 374 | | |
| |||
0 commit comments