You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Consider this code sample:
def g():
try:
yield 1
finally:
print 'finally'
g().next()
CPython behaves differently from PyPy:
$ python2.7 asd.py
finally
---
$ pypy asd.py
---
The finally suite is executed only if the generator is exhausted in such way
that StopIteration is raised.
The finally is printed when the generator object is garbage collected.
Since CPython has reference counting, the generator is collected immediately,
while on PyPy is not.
If you add "import gc; gc.collect()" at the end of the script, the "finally" is
printed also on Pypy
In Heptapod by bitbucket_importer on Jun 3, 2011, 12:07
Created originally on Bitbucket by JonasH (Jonas Hunkemoeller)
From (bugs.pypy.org)
The text was updated successfully, but these errors were encountered: