[XLA:Python] Fix crash when accessing locals of JAX-generated Python tracebacks.

Use a dummy PyCodeObject in our dummy PyFrameObjects. Using a real PyCodeObject with a fake PyFrameObject confuses CPython 3.11+ when it attempts to compute the locals of a frame, since the frame lacks certain details such as closure information.

This unfortunately means we will not get source column information under Python 3.11 any more, but that is probably better than crashing.

Fixes https://github.com/google/jax/issues/16027

PiperOrigin-RevId: 538873850
This commit is contained in:
Peter Hawkins 2023-06-08 13:21:43 -07:00 committed by jax authors
parent a47aca8205
commit 6374b73ce6

View File

@ -33,6 +33,8 @@ Remember to align the itemized text with the first line of an item within a list
* Bug fixes
* Fixes incorrect source line information in JAX-generated Python tracebacks
under Python 3.11.
* Fixes crash when printing local variables of frames in JAX-generated Python
tracebacks (#16027).
## jax 0.4.11 (May 31, 2023)