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

Skip to content

Commit 35974fb

Browse files
committed
Fix for SF bug #489671 (Neil Norwitz): memory leak in test_richcmp.
Had nothing to do with rich comparisons -- some stack cleanup code was lost as a result of merging in Neil Schemenauer's generators patch. Reinserted the stack cleanup code, skipping it when yielding.
1 parent ffa260f commit 35974fb

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

Python/ceval.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2296,6 +2296,14 @@ eval_frame(PyFrameObject *f)
22962296

22972297
} /* main loop */
22982298

2299+
if (why != WHY_YIELD) {
2300+
/* Pop remaining stack entries -- but when yielding */
2301+
while (!EMPTY()) {
2302+
v = POP();
2303+
Py_XDECREF(v);
2304+
}
2305+
}
2306+
22992307
if (why != WHY_RETURN && why != WHY_YIELD)
23002308
retval = NULL;
23012309

0 commit comments

Comments
 (0)