'NoneType' in contextmanager prevent proper RuntimeError to be raised

2015-05-20 Thread Daniel Gonçalves
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

Re: 'NoneType' in contextmanager prevent proper RuntimeError to be raised

2015-05-20 Thread Daniel Gonçalves
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