Pablo Galindo Salgado <[email protected]> added the comment:
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
----------
nosy: +pablogsal
resolution: -> not a bug
stage: -> resolved
status: open -> closed
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue35867>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com