Issue1194
Created on 2008-12-08.08:36:42 by terrence, last changed 2008-12-09.21:57:42 by pjenvey.
File name |
Uploaded |
Description |
Edit |
Remove |
with.py
|
terrence,
2008-12-08.08:36:41
|
A test case that demonstrates the problem. |
|
|
test_with_return_calls_exit.diff
|
terrence,
2008-12-08.09:25:21
|
This patch adds a failing test for this bug to the jython regrtest suite. |
|
|
msg3885 (view) |
Author: Terrence Cole (terrence) |
Date: 2008-12-08.08:36:41 |
|
A minimal test case:
#!/usr/bin/jython
from __future__ import with_statement
from threading import Lock, RLock
def func_return():
lock = Lock()
with lock:
return lock
if func_return()._is_owned(): print "FAIL!"
else print "OK"
# eof
After annotating __enter__ and __exit__ of RLock with print statements,
it appears that __exit__ is not getting called in this case, but is in
other similar cases (see more detailed attached test case for cases that
pass). The jython I'm using was compiled from svn on 7 Dec 2008.
|
msg3886 (view) |
Author: Terrence Cole (terrence) |
Date: 2008-12-08.09:25:21 |
|
Attached a patch to add a test for this case to the regrtest testsuite.
|
msg3887 (view) |
Author: Raghuram Devarakonda (draghuram) |
Date: 2008-12-08.15:25:22 |
|
I have confirmed this behaviour with the following simple script (run on
Linux).
---
from __future__ import with_statement
class test:
def __init__(self):
pass
def __enter__(self):
print "in enter"
return self
def __exit__(self, exc_type, exc_val, exc_tb):
print "in exit"
return False
def f():
with test():
return
f()
---
akash$ jython testwith.py
in enter
akash$ jython
Jython 2.5a3+ (trunk:5430M, Oct 16 2008, 12:29:25)
[Java HotSpot(TM) Client VM (Sun Microsystems Inc.)] on java1.6.0_06
|
msg3891 (view) |
Author: Philip Jenvey (pjenvey) |
Date: 2008-12-08.20:58:41 |
|
Looks like our compiler is generating a try: catch: instead of a try:
finally: for these
|
msg3894 (view) |
Author: Philip Jenvey (pjenvey) |
Date: 2008-12-09.21:57:42 |
|
fixed in r5724
note the bytecode magic hasn't changed for this yet, so you'll want to
remove older $py.class's before trying it
thanks!
|
|
Date |
User |
Action |
Args |
2008-12-09 21:57:42 | pjenvey | set | status: open -> closed resolution: fixed messages:
+ msg3894 components:
+ None, - Core |
2008-12-09 04:31:42 | pjenvey | set | assignee: pjenvey |
2008-12-08 22:50:47 | loewis | set | files:
- README.diff |
2008-12-08 22:50:26 | loewis | set | files:
+ README.diff keywords:
+ patch |
2008-12-08 20:58:42 | pjenvey | set | nosy:
+ pjenvey messages:
+ msg3891 |
2008-12-08 15:25:23 | draghuram | set | nosy:
+ draghuram messages:
+ msg3887 |
2008-12-08 09:25:22 | terrence | set | files:
+ test_with_return_calls_exit.diff messages:
+ msg3886 |
2008-12-08 08:36:42 | terrence | create | |
|