New submission from STINNER Victor <vstin...@redhat.com>:

Copy of Stefan Behnel's msg345305 in bpo-37221:
"""
Note that PyCode_New() is not the only change in 3.8 beta1 that breaks Cython 
generated code. The renaming of "tp_print" to "tp_vectorcall" is equally 
disruptive, because Cython has (or had) a work-around for CPython 
(mis-)behaviour that reset the field explicitly to NULL after calling 
PyType_Ready(), which could set it arbitrarily without good reason.

So, either revert that field renaming, too, or ignore Cython generated modules 
for the reasoning about the change in this ticket.

I'm fine with keeping things as they are now in beta-1, but we could obviously 
adapt to whatever beta-2 wants to change again.
"""

There are 2 problems:

* source compatibility
* ABI compatibility

The following change removed PyTypeObject.tp_print and replaced it with 
PyTypeObject.tp_vectorcall_offset:

commit aacc77fbd77640a8f03638216fa09372cc21673d
Author: Jeroen Demeyer <j.deme...@ugent.be>
Date:   Wed May 29 20:31:52 2019 +0200

    bpo-36974: implement PEP 590 (GH-13185)
    
    
    Co-authored-by: Jeroen Demeyer <j.deme...@ugent.be>
    Co-authored-by: Mark Shannon <m...@hotpy.org>


== ABI compatibility ==

In term of ABI, it means that C extensions using static type ("static 
PyTypeObject mytype = { .... };") is broken by this change.

Honestly, I'm not sure if we ever provided any forward compatibility for static 
types. bpo-32388 removed "cross-version binary compatibility" on purpose in 
Python 3.8. It's an on-going topic, see also my notes about ABI and 
PyTypeObject:
https://pythoncapi.readthedocs.io/type_object.html

Maybe we can simply ignore this part of the problem.


== Source compatibility ==

Cython generates C code setting tp_print explicitly to NULL.

To avoid depending on Cython at installation, most (if not all) projects using 
Cython include C files generated by Cython in files they distribute (like 
tarballs). Because of that, the commit aacc77fbd77640a8f03638216fa09372cc21673d 
requires all these projects to regenerate their C files using Cython.

In Fedora, we fixed many Python packages to always re-run Cython to regenerate 
all C files. But Fedora is just one way to distribute packages, it doesn't 
solve the problem of files distributed on PyPI, nor other Linux distribution 
(for example).

Jeroen Demeyer proposed PR 14009 to fix the source compatibility:

   #define tp_print tp_vectorcall

----------
components: Interpreter Core
messages: 345337
nosy: vstinner
priority: normal
severity: normal
status: open
title: C files generated by Cython set tp_print to NULL
versions: Python 3.8

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue37250>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to