[issue29600] Returning an exception object from a coroutine triggers implicit exception chaining?!?

2017-03-14 Thread Yury Selivanov

Yury Selivanov added the comment:

> I am wondering how much of other uses of PyErr_SetObject() are affected by 
> similar bugs?

Only when we use an exception to carry a return value.  AFAIK StopIteration is 
the only such case.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29600] Returning an exception object from a coroutine triggers implicit exception chaining?!?

2017-03-14 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

I am wondering how much of other uses of PyErr_SetObject() are affected by 
similar bugs?

--
nosy: +serhiy.storchaka

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29600] Returning an exception object from a coroutine triggers implicit exception chaining?!?

2017-03-12 Thread Yury Selivanov

Changes by Yury Selivanov :


--
resolution:  -> fixed
stage:  -> resolved
status: open -> closed
type:  -> behavior

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29600] Returning an exception object from a coroutine triggers implicit exception chaining?!?

2017-03-12 Thread Yury Selivanov

Yury Selivanov added the comment:

What a bizarre bug.  Created a PR with a fix.  

Nathaniel, please put me in a nosy list when you submit issues about 
generators/coroutines.

--
nosy: +yselivanov

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29600] Returning an exception object from a coroutine triggers implicit exception chaining?!?

2017-03-12 Thread Yury Selivanov

Changes by Yury Selivanov :


--
pull_requests: +533

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29600] Returning an exception object from a coroutine triggers implicit exception chaining?!?

2017-02-19 Thread Nathaniel Smith

New submission from Nathaniel Smith:

The following code prints "KeyError()", which is obviously wrong and rather 
baffling. Just passing an exception object around *as an object* should not 
trigger implicit exception chaining!

If you replace the async functions with regular functions then it prints 
"None", as expected.

Checked on 3.5, 3.6, and more-or-less current master -- bug is present in all 3.



async def f():
return ValueError()

async def g():
try:
raise KeyError
except:
value_error = await f()
print(repr(value_error.__context__))

try:
g().send(None)
except StopIteration:
pass

--
components: Interpreter Core
messages: 288133
nosy: njs
priority: normal
severity: normal
status: open
title: Returning an exception object from a coroutine triggers implicit 
exception chaining?!?
versions: Python 3.5, Python 3.6, Python 3.7

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com