There is an incompatibility of Jython 2.5a1 to Cpython 2.5 when using yield and break in the following way:

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"


Jython 2.5a1 provides the following output when calling test3():

gen3 for  0
test3 for  0
test3 finally


wheras Python 2.5 provides some different output when calling test3():

gen3 for  0
test3 for  0
gen3 finally
test3 finally

It seems that the finally block of gen3 does not get called after calling break in the for loop of test3.

Thanks
Egon

---
Egon Wuchner
egon.wuchner@siemens.com
Siemens AG, Corporate Research and Technologies Software & Engineering
Software Architecture, Otto-Hahn-Ring 6, 81730 Munich, Germany
+49 89 636 45848, Fax -45450, Room 53534

Siemens Aktiengesellschaft: Chairman of the Supervisory Board: Gerhard Cromme; Managing Board: Peter Loescher, Chairman, President and Chief Executive Officer; Wolfgang Dehen, Heinrich Hiesinger, Joe Kaeser, Erich R. Reinhardt, Hermann Requardt, Siegfried Russwurm, Peter Y. Solmssen; Registered offices: Berlin and Munich; Commercial registries: Berlin Charlottenburg, HRB 12300, Munich, HRB 6684; WEEE-Reg.-No. DE 23691322