mypy
3cf57e11 - [mypyc] Fix undefined behavior related to empty vecs (#21094)

Commit
98 days ago
[mypyc] Fix undefined behavior related to empty vecs (#21094) We used to use `&vec.buf->items`, which causes undefined behavior for an empty vec that can be triggered on GCC when using -O3, since `buf` is NULL for an empty vec. Use `offsetof` instead to calculate struct field offset, since it doesn't trigger UB if pointer is NULL.
Author
Parents
Loading