mirror of
https://github.com/python/cpython.git
synced 2025-11-24 20:30:18 +00:00
[3.14] gh-139988: fix a leak when failing to create a Union type (GH-139990) (#139993)
gh-139988: fix a leak when failing to create a Union type (GH-139990)
(cherry picked from commit 6710156bd2)
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
This commit is contained in:
parent
ae91b4bcd0
commit
3b9694a8e6
2 changed files with 4 additions and 0 deletions
|
|
@ -0,0 +1,2 @@
|
||||||
|
Fix a memory leak when failing to create a :class:`~typing.Union` type.
|
||||||
|
Patch by Bénédikt Tran.
|
||||||
|
|
@ -474,11 +474,13 @@ _Py_union_from_tuple(PyObject *args)
|
||||||
}
|
}
|
||||||
if (PyTuple_CheckExact(args)) {
|
if (PyTuple_CheckExact(args)) {
|
||||||
if (!unionbuilder_add_tuple(&ub, args)) {
|
if (!unionbuilder_add_tuple(&ub, args)) {
|
||||||
|
unionbuilder_finalize(&ub);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (!unionbuilder_add_single(&ub, args)) {
|
if (!unionbuilder_add_single(&ub, args)) {
|
||||||
|
unionbuilder_finalize(&ub);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue