This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author tcdelaney
Recipients
Date 2006-04-01.00:17:59
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content
Given:

@contextmanager
def gen():
    print '__enter__'

    try:
        yield
    finally:
        print '__exit__'

with gen():
    raise StopIteration('body')


running the above results in:

__enter__
__exit__


I would have expected instead

__enter__
__exit__
Traceback (most recent call last):
  File "test25.py", line 53, in <module>
    raise StopIteration('body')
StopIteration: body


Note that doing:

with gen():
    raise GeneratorExit('body')

does the expected thing:

__enter__
__exit__
Traceback (most recent call last):
  File "test25.py", line 53, in <module>
    raise GeneratorExit('body')
GeneratorExit: body
History
Date User Action Args
2007-08-23 14:39:02adminlinkissue1462485 messages
2007-08-23 14:39:02admincreate