gh-98724: Fix type punning issue in Py_SETREF() by vstinner · Pull Request #99739 · python/cpython (original) (raw)

#define _PY_TYPEOF(EXPR) typeof(EXPR)

On GCC and clang, typeof() can maybe used. In "GNU mode", typeof is treated as a keyword by the C compiler.

On MSVC, if __typeof__() doesn't work, maybe decltype() can be used instead.