mirror of
https://github.com/python/cpython.git
synced 2025-11-25 04:34:37 +00:00
gh-139988: fix a leak when failing to create a Union type (#139990)
This commit is contained in:
parent
a18843dbfb
commit
6710156bd2
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 (!unionbuilder_add_tuple(&ub, args)) {
|
||||
unionbuilder_finalize(&ub);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (!unionbuilder_add_single(&ub, args)) {
|
||||
unionbuilder_finalize(&ub);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue