Message3633

Author ruseel
Recipients ruseel
Date 2008-10-02.04:18:41
SpamBayes Score 1.0796593e-09
Marked as misclassified No
Message-id <1222921122.45.0.694551434159.issue1142@psf.upfronthosting.co.za>
In-reply-to
Content
If there is nested contextmanager and try clause does not work as expected

with another_contextmanager():
  try: 
    with some_error_rasing_contextmanager():
      pass
  except:
    print 'catch'

----

enex:src ruseel$ python --version
Python 2.5.1
enex:src ruseel$ python test_contextmanager.py 
catch
.
----------------------------------------------------------------------
Ran 1 test in 0.000s

OK
enex:src ruseel$ jython --version
Jython 2.5a3 (trunk:5315:5317, Sep 10 2008, 20:54:23) 
[Java HotSpot(TM) Client VM (Apple Inc.)] on java1.5.0_13
enex:src ruseel$ jython test_contextmanager.py 
E
======================================================================
ERROR: test_a (__main__.TestContextManager)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "test_contextmanager.py", line 0, in test_a
  File "/Users/ruseel/jython2.5a3/Lib/contextlib.py", line 81, in helper
    return GeneratorContextManager(func(*args, **kwds))
  File "test_contextmanager.py", line 7, in some_cm
    raise ValueError('error from some_cm()')
ValueError: error from some_cm()

----------------------------------------------------------------------
Ran 1 test in 0.019s

FAILED (errors=1)
History
Date User Action Args
2008-10-02 04:18:42ruseelsetrecipients: + ruseel
2008-10-02 04:18:42ruseelsetmessageid: <1222921122.45.0.694551434159.issue1142@psf.upfronthosting.co.za>
2008-10-02 04:18:42ruseellinkissue1142 messages
2008-10-02 04:18:41ruseelcreate