This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author pablogsal
Recipients Sampsa Riikonen, asvetlov, eamanu, pablogsal, yselivanov
Date 2019-02-21.21:50:41
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1550785842.03.0.529177732355.issue35867@roundup.psfhosted.org>
In-reply-to
Content
I do not think this is a bug. Any exception that is raised inside a task will be in the .exception() method when the task is finished. Here you are running the task without waiting for finalization. For example, if you change:

    async def cofunc1(self):
        await self.cofunc2()
        await self.task # <-------------
        print("\nwaitin' : where-t-f is the NameError hiding!?")
        await asyncio.sleep(6)
        print("Wait is over, let's exit\n")

you will find the NameError immediately. If you do not want to await the task you can wait until self.task.done() is True and then check self.task.exception() for retrieving the exception (if any).

What happens with BaseException is that is a very low-level exception that is handled differently compared with regular exceptions that derive from Exception. The reason is that control flow exceptions and things like KeyboardInterrupt need to be handled differently. This happens explicitly here:

https://github.com/python/cpython/blob/master/Modules/_asynciomodule.c#L2675
History
Date User Action Args
2019-02-21 21:50:42pablogsalsetrecipients: + pablogsal, asvetlov, yselivanov, eamanu, Sampsa Riikonen
2019-02-21 21:50:42pablogsalsetmessageid: <1550785842.03.0.529177732355.issue35867@roundup.psfhosted.org>
2019-02-21 21:50:42pablogsallinkissue35867 messages
2019-02-21 21:50:41pablogsalcreate