mypy
bb3e4979 - [mypyc] Fix crash on accessing StopAsyncIteration (#21406)

Commit
59 days ago
[mypyc] Fix crash on accessing StopAsyncIteration (#21406) Using `StopAsyncIteration` in `raise` expressions or as the caught type in `except` blocks crashes at runtime because the generated code loads the address of the `PyExc_StopAsyncIteration` variable and casts it to `PyObject *`. The variable itself [is already](https://github.com/python/cpython/blob/main/Include/pyerrors.h#L80) a `PyObject *` so its address being interpreted as `PyObject *` is incorrect. To fix, add a special case to use `LoadGlobal` instead of `LoadAddress` for builtin type variables that are already `PyObject *`.
Author
Parents
Loading