[issue39839] Non-working error handler when creating a task with assigning a variable

2020-05-18 Thread Chris Jerdonek
Chris Jerdonek added the comment: I took a look at this. Basically, the reason the exception handler isn't firing when the task is still in scope is that the exception handler is only a handler of "last resort." You can see that the exception handler is called inside Task.__del__ here:

[issue39839] Non-working error handler when creating a task with assigning a variable

2020-05-18 Thread Chris Jerdonek
Change by Chris Jerdonek : -- nosy: +chris.jerdonek ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue39839] Non-working error handler when creating a task with assigning a variable

2020-03-15 Thread Caleb Hattingh
Caleb Hattingh added the comment: Can reproduce also on 3.8. Another version that "works" (raises the exception) is task = loop.create_task(test()) del task Suggests there's something going on with reference counting or garbage collection. In the version that "doesn't work", the

[issue39839] Non-working error handler when creating a task with assigning a variable

2020-03-03 Thread Rustam Shakh
Rustam Shakh added the comment: # This line doesn`t work task = loop.create_task(test()) # This line works loop.create_task(test()) -- ___ Python tracker ___

[issue39839] Non-working error handler when creating a task with assigning a variable

2020-03-03 Thread Рустам Шах
New submission from Рустам Шах : #This example does not work due to assigning the task to a variable import asyncio import logging def handle_exception(loop, context): msg = context.get("exception", context["message"]) logging.error("Caught exception: %s", msg) async def test():