Skip to content

Commit 568a470

Browse files
committed
fix up refcounting
1 parent 142859a commit 568a470

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

Python/compile.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5254,9 +5254,11 @@ push_inlined_comprehension_state(struct compiler *c, location loc,
52545254
// comprehension
52555255
Py_INCREF(outv);
52565256
if (PyDict_SetItem(c->u->u_ste->ste_symbols, k, v)) {
5257+
Py_DECREF(outv);
52575258
return ERROR;
52585259
}
52595260
if (PyDict_SetItem(state->temp_symbols, k, outv)) {
5261+
Py_DECREF(outv);
52605262
return ERROR;
52615263
}
52625264
Py_DECREF(outv);
@@ -5422,6 +5424,8 @@ compiler_comprehension(struct compiler *c, expr_ty e, int type,
54225424
if (pop_inlined_comprehension_state(c, loc, inline_state)) {
54235425
goto error;
54245426
}
5427+
Py_XDECREF(inline_state.pushed_locals);
5428+
Py_XDECREF(inline_state.temp_symbols);
54255429
return SUCCESS;
54265430
}
54275431

@@ -5468,6 +5472,7 @@ compiler_comprehension(struct compiler *c, expr_ty e, int type,
54685472
}
54695473
error:
54705474
Py_XDECREF(co);
5475+
Py_XDECREF(entry);
54715476
Py_XDECREF(inline_state.pushed_locals);
54725477
Py_XDECREF(inline_state.temp_symbols);
54735478
return ERROR;

Python/symtable.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -927,6 +927,7 @@ analyze_block(PySTEntryObject *ste, PyObject *bound, PyObject *free,
927927
Py_DECREF(child_free);
928928
if (!temp)
929929
goto error;
930+
Py_DECREF(temp);
930931
/* Check if any children have free variables */
931932
if (entry->ste_free || entry->ste_child_free)
932933
ste->ste_child_free = 1;

0 commit comments

Comments
 (0)