[issue37250] C files generated by Cython set tp_print to NULL: PyTypeObject.tp_print removed, replaced with tp_vectorcall_offset
STINNER Victor
report at bugs.python.org
Wed Jun 12 09:36:43 EDT 2019
STINNER Victor <vstinner at redhat.com> added the comment:
me:
> I understand that tp_vectorcall_offset=0 is fine and the expected value for a type which doesn't have the flag _Py_TPFLAGS_HAVE_VECTORCALL.
Jeroen Demeyer:
> Not necessarily. There are subtleties involved when subclassing: there are cases where tp_vectorcall_offset needs to be non-zero despite _Py_TPFLAGS_HAVE_VECTORCALL not being set. See also PR 13858.
Cython generates C code which looks like:
if (PyType_Ready(type) < 0) { ... handle error ... }
type->tp_print = 0;
This code can cause subtle and annoying issue if PR 13858 is merged. So that's another argument in favor of reintroducing tp_print in Python 3.8.
--
Cython has already been fixed to no longer set tp_print to 0 on Python 3.8:
https://github.com/cython/cython/commit/f10a0a391edef10bd37095af87f521808cb362f7
But again, this problem is not about correctness, but more about practical backward compatibility issues (see my first message).
----------
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue37250>
_______________________________________
More information about the Python-bugs-list
mailing list