Uh oh!
There was an error while loading. Please reload this page.
GH-97592: Fix crash in C remove_done_callback due to evil code - #97660
Conversation
10daef4 to
d407a0bCompare2ee888c to
00b9536Comparegvanrossum
commented
Sep 29, 2022
@xiaxinmeng Feel free to add your review. |
Uh oh!
There was an error while loading. Please reload this page.
| class evil: | ||
| def __eq__(self, other): | ||
| fut.remove_done_callback(other) | ||
| fut.remove_done_callback(evil()) |
There was a problem hiding this comment.
Class names should normally use the CapWords convention.
| classevil: | |
| def__eq__(self, other): | |
| fut.remove_done_callback(other) | |
| fut.remove_done_callback(evil()) | |
| classEvil: | |
| def__eq__(self, other): | |
| fut.remove_done_callback(other) | |
| fut.remove_done_callback(Evil()) |
| def __eq__(self, other): | ||
| fut.remove_done_callback(other) | ||
| fut.remove_done_callback(evil()) |
There was a problem hiding this comment.
All callbacks added by fut.add_done_callback() will be cleared when calling fut.remove_done_callback(Evil()), but the return value will be the number of callbacks added last.
I'm not sure if we need to improve the return value of remove done callback further, the current changes are good enough to fix the crash. :)
Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
miss-islington
commented
Sep 30, 2022
Thanks @gvanrossum for the PR 🌮🎉.. I'm working now to backport this PR to: 3.10, 3.11. |
bedevere-bot
commented
Sep 30, 2022
GH-97692 is a backport of this pull request to the 3.11 branch. |
…ythonGH-97660) Evil code could cause fut_callbacks to be cleared when PyObject_RichCompareBool is called. (cherry picked from commit 63780f4) Co-authored-by: Guido van Rossum <guido@python.org>
bedevere-bot
commented
Sep 30, 2022
GH-97693 is a backport of this pull request to the 3.10 branch. |
…ythonGH-97660) Evil code could cause fut_callbacks to be cleared when PyObject_RichCompareBool is called. (cherry picked from commit 63780f4) Co-authored-by: Guido van Rossum <guido@python.org>
) Evil code could cause fut_callbacks to be cleared when PyObject_RichCompareBool is called. (cherry picked from commit 63780f4) Co-authored-by: Guido van Rossum <guido@python.org>
) Evil code could cause fut_callbacks to be cleared when PyObject_RichCompareBool is called. (cherry picked from commit 63780f4) Co-authored-by: Guido van Rossum <guido@python.org>
…ython#97660) Evil code could cause fut_callbacks to be cleared when PyObject_RichCompareBool is called.
Uh oh!
There was an error while loading. Please reload this page.