#21 Pyke does not run on IronPython 2.0B3 and Jython 2.5a1

0.3
closed-fixed
pyke (39)
5
2008-11-24
2008-08-20
egon
No

Generated pyke rules rely on the fact that CPython garbage collects all objects immediately as soon as they are no longer used. But this is not true for IronPython and Jython.

Take the following example:

def gen3(n):
try:
for x in range(n):
print "gen3 for ", x
yield x
finally:
print "gen3 finally"

def test3():
try:
for x in gen3(3):
print "test3 for ", x
break
finally:
print "test3 finally"

With CPython when test3 breaks within the for loop the finally clause of gen3 will be called. This does not apply to IronPython and Jython. Instead you would have to rewrite the test3 function in the following way to get the same result:

def test3():
g = gen(3)
try:
for x in g:
print "test3 for ", x
break
finally:
g.close()
print "test3 finally"

Thus, the Pyke compiler needs to be modified to explicitly call close.

Discussion

  • Bruce Frederiksen

    Logged In: YES
    user_id=301752
    Originator: NO

    OK, I've assigned this to you Egon! :-)

     
  • Bruce Frederiksen

    • assigned_to: mtnyogi --> egon_wuchner
     
  • Bruce Frederiksen

    • assigned_to: egon_wuchner --> mtnyogi
    • status: open --> pending-fixed
     
  • Bruce Frederiksen

    Fixed in release 0.5, but the test of the fix is waiting on new releases of IronPython and Jython.

     
  • SourceForge Robot

    This Tracker item was closed automatically by the system. It was
    previously set to a Pending status, and the original submitter
    did not respond within 14 days (the time period specified by
    the administrator of this Tracker).

     
  • SourceForge Robot

    • status: pending-fixed --> closed-fixed
     
  • Bruce Frederiksen

    This fix has been tested and now works on Jython.

    The fix was also tested on IronPython, but there is an obscure bug on IronPython that prevents Pyke from working there. This bug has been reported in the IronPython bug tracking system as item# 20143, if you care to follow it. Also, apparently you can "vote" for bugs on their list...

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks