8000 Addition to Issue#117783 by morkev · Pull Request #118408 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

Addition to Issue#117783 #118408

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

Closed
wants to merge 3 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Prevent altering active exceptions in PyObject_ClearWeakRefs() and en…
…sure weakrefs clearance on tuple allocation failure
  • Loading branch information
morkev authored Apr 29, 2024
commit ab183ea69ee99569c5a37a2cc3ad87cfcd2c6a4d
2 changes: 2 additions & 0 deletions Objects/weakrefobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -1019,8 +1019,10 @@ PyObject_ClearWeakRefs(PyObject *object)
_PyWeakref_ClearWeakRefsExceptCallbacks(object);
PyErr_WriteUnraisable(NULL);
PyErr_SetRaisedException(exc);
Py_XDECREF(exc); // Clean up the reference to the exception object
return;
}
Py_XDECREF(exc); // Clean up the reference if tuple creation is successful

Py_ssize_t num_items = 0;
for (int done = 0; !done;) {
Expand Down
0