Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 5b2b3aa

Browse files
committed
merge 3.5 (#26991)
2 parents 2deb1ea + ad887cf commit 5b2b3aa

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

Misc/NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ Release date: tba
1010
Core and Builtins
1111
-----------------
1212

13+
- Issue #26991: Fix possible refleak when creating a function with annotations.
14+
1315
- Issue #27039: Fixed bytearray.remove() for values greater than 127. Based on
1416
patch by Joe Jevnik.
1517

Python/ceval.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3291,6 +3291,7 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
32913291
PyObject *anns = PyDict_New();
32923292
if (anns == NULL) {
32933293
Py_DECREF(func);
3294+
Py_DECREF(names);
32943295
goto error;
32953296
}
32963297
name_ix = PyTuple_Size(names);
@@ -3306,9 +3307,11 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
33063307
if (err != 0) {
33073308
Py_DECREF(anns);
33083309
Py_DECREF(func);
3310+
Py_DECREF(names);
33093311
goto error;
33103312
}
33113313
}
3314+
Py_DECREF(names);
33123315

33133316
if (PyFunction_SetAnnotations(func, anns) != 0) {
33143317
/* Can't happen unless
@@ -3318,7 +3321,6 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
33183321
goto error;
33193322
}
33203323
Py_DECREF(anns);
3321-
Py_DECREF(names);
33223324
}
33233325

33243326
/* XXX Maybe this should be a separate opcode? */

0 commit comments

Comments
 (0)