mirror of
https://github.com/python/cpython.git
synced 2025-11-24 12:20:42 +00:00
[3.14] gh-140530: fix a reference leak in an error path for raise exc from cause (GH-140908) (#141282)
gh-140530: fix a reference leak in an error path for `raise exc from cause` (GH-140908)
Fix a reference leak in `raise E from T` when `T` is an exception
subtype for which `T.__new__` does not return an exception instance.
(cherry picked from commit 0c77e7c23b)
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
This commit is contained in:
parent
cb458715a6
commit
d7aace78e9
3 changed files with 10 additions and 11 deletions
|
|
@ -2108,6 +2108,7 @@ do_raise(PyThreadState *tstate, PyObject *exc, PyObject *cause)
|
|||
"calling %R should have returned an instance of "
|
||||
"BaseException, not %R",
|
||||
cause, Py_TYPE(fixed_cause));
|
||||
Py_DECREF(fixed_cause);
|
||||
goto raise_error;
|
||||
}
|
||||
Py_DECREF(cause);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue