Commit 5b2b3aae authored by Benjamin Peterson's avatar Benjamin Peterson

merge 3.5 (#26991)

parents 2deb1eaf ad887cf7
...@@ -10,6 +10,8 @@ Release date: tba ...@@ -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. Based on - Issue #27039: Fixed bytearray.remove() for values greater than 127. Based on
patch by Joe Jevnik. patch by Joe Jevnik.
......
...@@ -3291,6 +3291,7 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag) ...@@ -3291,6 +3291,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);
...@@ -3306,9 +3307,11 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag) ...@@ -3306,9 +3307,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
...@@ -3318,7 +3321,6 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag) ...@@ -3318,7 +3321,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? */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment