-
-
Notifications
You must be signed in to change notification settings - Fork 33k
gh-139276: Remove generator type check in _testcapimodule.c:raise_SIGINT_then_send_None #139252
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
Conversation
Please create an issue for this one first (no need for a NEWS entry however).
Maybe we should instead mark the test as CPython-only? it seems that it's quite specific to CPython in the sense that a comment says that we check for signals before every bytecode instruction (but maybe this is different in other implementations). There are some other test functions that also check for specific types which could be different on other implementations, so maybe it's a wider issue (I don't know the answer to that question). cc @njsmith as the original PR's author (though I don't know if they are still active on GitHub). |
As an alternative implementation author, this is functionality I'd probably be aiming to reproduce by default. Or at least it would be very considered if we decided not to handle signals in the same places as CPython. If we didn't do that, there will probably be some existing code which depends on this behavior and subtly breaks.
There area a few other issues with using our own types for generators... At some point I, or someone I work with will hopefully come up with some proposals to fix these. For now we've been able to work around most of them without upstream changes though. |
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.
Maybe we should then change PyGenObject *gen;
to be PyObject *gen
? Since we don't use any PyGenObject
specific APIs.
(sorry, "approve" is a misclick, I meant to ask a question) |
Ah yes, I didn't even notice that before. Fixed now. |
In the Cinder JIT we use a different type for generators, which breaks the test which uses this function. In general I believe the intent with generators is they have the right structure rather than type, so a failure to find the 'send()' method is arguably more correct if the wrong object is used.
95cedb9
to
61543b3
Compare
|
The buildbot failure looks like it's unrelated to this change. Past runs on the same buildbot have failed with the same error. |
@jbower-fb We could backport this change up to 3.13. Would it be good for you that we do so? or is it fine to keep it in |
In the Cinder JIT we use a different type for generators, which breaks the test which uses this function.
In general I believe the intent with generators is they have the right structure rather than type, so a failure to find the
send()
method is arguably more correct if the wrong object is used.