-
-
Notifications
You must be signed in to change notification settings - Fork 31.9k
gh-111654: remove redundant decref on the eval stack value #111655
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
…DEREF in error path
@@ -1550,6 +1548,7 @@ dummy_func( | |||
} | |||
Py_INCREF(value); | |||
} | |||
Py_DECREF(class_dict); |
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.
This DECREF won't happen if we GOTO_ERROR on line 1547. Is that the idea?
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.
Yes, this is the expected behavior. I'll add some notes on the first comment.
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.
Thanks!
Thanks @aisk for the PR, and @JelleZijlstra for merging it 🌮🎉.. I'm working now to backport this PR to: 3.12. |
Sorry, @aisk and @JelleZijlstra, I could not cleanly backport this to
|
GH-111674 is a backport of this pull request to the 3.12 branch. |
…DEREF (pythonGH-111655) (cherry picked from commit 3a1b09e) Co-authored-by: AN Long <aisk@users.noreply.github.com>
|
|
This is just like #109123, but for another OP code. In the error path, the
class_dict
is still on the value stack, and the error unwinding process will call decref on it. So we should remove the decref in error path, or there will be a double decref, and cause the ref count to negative in the GC process, and leads to the runtime crash.