When you decorate a function with contextmanager that didn't yield you got an
AttributeError instead of a proper RuntimeError "generator didn't yield". For
example:
>>> @contextlib.contextmanager
>>> def foo():
... pass
...
>>> with foo():
... do_something()
...
Traceback (most recent ca
ibute 'next', instead of the proper RuntimeError, making it harder
to debug.
Anyways, I know that it's strange to have a contextmanager that didn't yield.
I just stumbled upon this, by accident, and I think the way it's
implemented looks wrong :)
2015-05-20 20:44 GMT