mirror of
https://github.com/python/cpython.git
synced 2025-07-25 12:14:38 +00:00
fix possible refleak in MAKE_FUNCTION (closes #26991)
Patch by Xiang Zhang.
This commit is contained in:
parent
0495fa81e6
commit
ad887cf7d1
2 changed files with 5 additions and 1 deletions
|
@ -10,6 +10,8 @@ Release date: tba
|
||||||
Core and Builtins
|
Core and Builtins
|
||||||
-----------------
|
-----------------
|
||||||
|
|
||||||
|
- Issue #26991: Fix possible refleak when creating a function with annotations.
|
||||||
|
|
||||||
- Issue #27039: Fixed bytearray.remove() for values greater than 127. Patch by
|
- Issue #27039: Fixed bytearray.remove() for values greater than 127. Patch by
|
||||||
Joe Jevnik.
|
Joe Jevnik.
|
||||||
|
|
||||||
|
|
|
@ -3284,6 +3284,7 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
|
||||||
PyObject *anns = PyDict_New();
|
PyObject *anns = PyDict_New();
|
||||||
if (anns == NULL) {
|
if (anns == NULL) {
|
||||||
Py_DECREF(func);
|
Py_DECREF(func);
|
||||||
|
Py_DECREF(names);
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
name_ix = PyTuple_Size(names);
|
name_ix = PyTuple_Size(names);
|
||||||
|
@ -3299,9 +3300,11 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
|
||||||
if (err != 0) {
|
if (err != 0) {
|
||||||
Py_DECREF(anns);
|
Py_DECREF(anns);
|
||||||
Py_DECREF(func);
|
Py_DECREF(func);
|
||||||
|
Py_DECREF(names);
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Py_DECREF(names);
|
||||||
|
|
||||||
if (PyFunction_SetAnnotations(func, anns) != 0) {
|
if (PyFunction_SetAnnotations(func, anns) != 0) {
|
||||||
/* Can't happen unless
|
/* Can't happen unless
|
||||||
|
@ -3311,7 +3314,6 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
Py_DECREF(anns);
|
Py_DECREF(anns);
|
||||||
Py_DECREF(names);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* XXX Maybe this should be a separate opcode? */
|
/* XXX Maybe this should be a separate opcode? */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue