Tim Peters wrote: > gen_iternext(): repair subtle refcount problem. > NeilS, please check! This came from staring at your genbug.py, but I'm > not sure it plugs all possible holes. Without this, I caught a > frameobject refcount going negative, and it was also the cause (in debug > build) of _Py_ForgetReference's attempt to forget an object with already- > NULL _ob_prev and _ob_next pointers -- although I'm still not entirely > sure how! Doesn't this cause a memory leak? f_back is INCREFed in PyFrame_New. There are other problems lurking here as well. def f(): try: yield 1 finally: print "finally" def h(): g = f() g.next() while 1: h() The above code leaks memory like mad, with or without your change. Also, the finally clause is never executed although it probably should be. My feeling is that the reference counting of f_back should be done by ceval and not by the frame object. The problem with the finally clause is another ball of wax. I think its fixable though. I'll look at it closer this evening. Neil
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4