Author njs
Recipients njs
Date 2017-02-19.13:44:49
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1487511889.54.0.248268466732.issue29600@psf.upfronthosting.co.za>
In-reply-to
Content
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
History
Date User Action Args
2017-02-19 13:44:49njssetrecipients: + njs
2017-02-19 13:44:49njssetmessageid: <1487511889.54.0.248268466732.issue29600@psf.upfronthosting.co.za>
2017-02-19 13:44:49njslinkissue29600 messages
2017-02-19 13:44:49njscreate