Missing tp_vectorcall slot in PyTypeObject on py3.8
It turns out we never added the tp_vectorcall slot to PyTypeObject in the Pypy3.8 release. This should have caused Cython to crash, but we have an extra field tp_pypy_flags
so the last few fields of that structure look like this for PyPy:
/* Type attribute cache version tag. Added in version 2.6 */
unsigned int tp_version_tag;
destructor tp_finalize;
printfunc tp_print; // deprecated, but stays around for compatibility
/* PyPy specific extra fields: make sure that they are ALWAYS at the end,
for compatibility with CPython */
long tp_pypy_flags;
} PyTypeObject;
and cython<0.29.25 spits out this code:
0, /*tp_version_tag*/
#if PY_VERSION_HEX >= 0x030400a1
0, /*tp_finalize*/
#endif
#if PY_VERSION_HEX >= 0x030800b1
0, /*tp_vectorcall*/
#endif
#if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
0, /*tp_print*/
#endif
};
So we lucked out: the fields happened to line up. But cython 0.29.26 Cython finally updated the fields to include the tp_pypy_flags
, so now the emitted code looks like
0, /*tp_version_tag*/
#if PY_VERSION_HEX >= 0x030400a1
0, /*tp_finalize*/
#endif
#if PY_VERSION_HEX >= 0x030800b1
0, /*tp_vectorcall*/
#endif
#if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
0, /*tp_print*/
#endif
#if CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM+0 >= 0x06000000
0, /*tp_pypy_flags*/
#endif
};
and suddenly the structure sizes do not match! It seems gcc doesn't really care, but MSVC errors out.