gh-118473: Fix set_asyncgen_hooks not to be partially set when arguments are invalid#118474
gh-118473: Fix set_asyncgen_hooks not to be partially set when arguments are invalid#118474gvanrossum merged 3 commits intopython:mainfrom
Conversation
b6b9069 to
c8474fc
Compare
|
I am starting to review. Please do not force push any more -- you can add new commits, and we will squash them when we merge the code. |
gvanrossum
left a comment
There was a problem hiding this comment.
I'm sorry, I don't like how you separated the audit calls from the setter functions, since it's conceivable that other (internal) code might call them, and the changes should always be audited.
I think a better refactoring would be to save the current finalizer hook and if setting the firstiter hook fails, restore the original finalizer. It still makes sense of course to do both callable checks before making any of the setter calls.
(Note that in your current PR there is a possible scenario where the second audit hook fails, no setters are called, but the first audit hook has already been called.)
Also, CC @zooba.
| @@ -0,0 +1 @@ | |||
| Fix set_asyncgen_hooks not to be partially set when raising TypeError | |||
There was a problem hiding this comment.
Please make this proper ReST markup with links to the code for set_asyncgen_hooks and TypeError, and end the sentence with a period. (I can help with the markup but consulting other news files should give ample examples.)
|
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase |
|
@gvanrossum Thank you for the guide! I have made the requested changes; please review again |
|
Thanks for making the requested changes! @gvanrossum: please review the changes made to this pull request. |
gvanrossum
left a comment
There was a problem hiding this comment.
Thanks! LGTM. I will merge this now, so it will make it into beta 1. Congrats!
|
@youknowone Do you think this should be backported to Python 3.12? It's a pure bugfix, so I think it could be. |
|
@gvanrossum No opinion about it. I found this bug not by running code, but by watching CPython source code. It is hard to imagine real world code make a try-except block for |
|
Then let's not backport. |
…arguments are invalid (python#118474)
Uh oh!
There was an error while loading. Please reload this page.