Nathaniel Smith added the comment:

I disagree with the stated reason for closing this, because in general, 
implicit context chaining doesn't care about where the exception was 
instantiated, only where it was raised. For example:

-----
err = ValueError()
try:
    raise KeyError
except Exception:
    raise err
-----

Prints:

-----
Traceback (most recent call last):
  File "/tmp/bar.py", line 3, in <module>
    raise KeyError
KeyError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/tmp/bar.py", line 5, in <module>
    raise err
ValueError
-----

I would expect 'gen.throw(OBJ)' to be equivalent to doing 'raise OBJ' inside 
the generator, and raise does set __context__.

----------
nosy: +njs

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue25683>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to