Message681
This program (also attached):
x = []
def trying():
try:
try:
x.append(1)
return
finally:
x.append(2)
finally:
x.append(3)
trying()
assert x == [1,2,3], repr(x)
outputs:
AssertionError: [1, 2]
Ie. the outer finally is not executed at return.
The workaround is simple: return after the last finally
and store an evt. return value in a temporary variable.
I did not experiment with raising exceptions instead
of returning.
In my case this bug caused a lock not to be released :)
Have fun,
Ype
ykingma@xs4all.nl
|
|
Date |
User |
Action |
Args |
2008-02-20 17:17:07 | admin | link | issue577395 messages |
2008-02-20 17:17:07 | admin | create | |
|