-
-
Notifications
You must be signed in to change notification settings - Fork 31.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[3.10] bpo-43760: Ensure that older Cython generated code compiles under 3.10 #28498
Conversation
…imize breakage in Cython generated modules.
This change breaks the ABI after Python 3.10.0rc1, whereas it was said that the ABI is not going to change, no? While PyThreadState is excluded from the limited C API and so the stable ABI, it's part of the public C API and the regular ABI. See for example the discussion on the numpy issue asking to get wheel packages for Python 3.10rc1: cc @hroncok |
@@ -148,6 +148,7 @@ struct _ts { | |||
uint64_t id; | |||
|
|||
CFrame root_cframe; | |||
int use_tracing; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't we add a comment explaining this field only exists for backwards compatibility and is only updated just before calling a trace function? (And in a few other odd places, but the key is that it's not the source of truth any more.)
Sorry, we cannot do this. We communicated loud for people to start providing 3.10 wheels with the release of 3.10rc1. They responded, there are already 3.10 wheels on PyPI for the following packages among the 2,500 most downloaded: asyncpg The only thing to do now is to communicate the API change in "What's New in Python 3.10". |
I hope the 3.10 release manager is in agreement. :-) |
@vstinner @ambv The ABI is not broken, the only thing that this PR change is the size of the struct. All the offsets to the members are the same and therefore will be valid in any compiled code. Any compiled wheels will still work. Look at the ABI report:
As you can see, the leaves of the change is only |
Carry on then, but we still need to communicate this in "What's New". |
I also opened this PR to discuss the possibility of going ahead, I still don't want to move on without consensus. |
What happens with C extensions setting |
I would prefer to add a new C API function to get and set the "tracing" state: https://bugs.python.org/issue43760#msg393410 But I'm not sure how to implement such API properly. |
That field is undocumented, there is no guarantee of anything. The thread state is not part of the limited API or the stable API, so people using the field are out of contract.
That cannot be done in Python 3.10. |
I don't understand why do you want adding again the field if you consider that removing it was an incompatible change. IMO it's part of the public C API. The contact with users is that they should use things prefixed by an underscore. But I'm not sure that it's useful to decide if
I'm fine with not adding back the field. |
As I said, I opened the PR to have the discussion based on Mark's other PR. Not because I think this is the best solution.
Where is says that "prefixed by an underscore" means "part of the public API". If that's the case we have violated that rule a lot of times on every release. |
We're talking about use_tracing and not tracing in thread state, correct? The tracing field is still used (I'm pretty sure) but the use_tracing field is not. FWIW, I consider adding a field to be binary incompatible, though it may be an acceptable incompatibility because no final 3.10 version has been released. I don't think the field needs to be re-added, though, even if there was more time. |
I am arguing the the whole structure is an implementation detail and therefore it can change at will between versions. |
It can (and did) change between 3.9 and 3.10. It shouldn't change between 3.10.1 and 3.10.2 because code that uses the field and is compiled against 3.10.2 will cause problems when the resulting binary is loaded into a 3.10.1 interpreter. This is why I call it an ABI change, though it may be acceptable when going from a rc to final. What I'm having trouble figuring out is what is the rationale for adding it back in at this point -- is there something other than there are packages on pypi that won't work? Shouldn't the authors of the packages be updating them for 3.10, probably by using a newer version of cython? |
We are on the same page here.
The change itself was done before we froze the ABI. We are discussing the implications of possibily adding it back.
Users that used the field in Python 3.9 and before complained that disappeared in 3.10 and therefore they cannot compile the extensions without changes. |
But the thread state structure does change from version to version, so extensions that use it need to be updated for 3.10. Has anyone uses this intentionally complained? The reasons to re-add it that I've seen seem to be about cython generated code. |
I refer you to the issue to understand specifically what users are worried about and what was the usage of the field. For example, this comment: https://bugs.python.org/msg402150 |
I discussed this particular instance with the Steering Council and the conclusion was that this field (use_tracing) is considered an implementation detail and therefore its removal it's justified so we won't be restoring it. I'm therefore closing this PR. notice that this decision only affects this particular issue and should not be generalized to other fields or structures. We will try to determine and open a discusion in the future about what is considered public/private in these ambiguous cases and what can users expect regarding stability and backwards compatibility. |
I see this as a list of 3rd party packages that need to be updated for 3.10; I don't see anything about why the may have difficulty updating. I do think the change should be documented (it may be at this point, I'm not sure). |
https://bugs.python.org/issue43760