[issue22428] asyncio: KeyboardInterrupt inside a coroutine causes AttributeError

2015-01-05 Thread STINNER Victor

STINNER Victor added the comment:

A lot of fixes has been commited to fix this general issue with asyncio at exit.

run_until_complete() doesn't log an error anymore when a BaseException (like 
KeyboardInterrupted) is raised. The caller is able to decide how to handle it.

The traceback module has been enhanced to try to fix the "AttributeError: 
'module' object has no attribute 'open'" error (or at least reduce the risk of 
such error). A better solution is being developed.

The initial issue was fixed, I close the issue. Thanks for the report Jack. 
Sorry, I forgot to update this issue since it was splitted in many smaller and 
more specific issues.

--
resolution:  -> fixed
status: open -> closed

___
Python tracker 

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



[issue22428] asyncio: KeyboardInterrupt inside a coroutine causes AttributeError

2014-10-10 Thread STINNER Victor

STINNER Victor added the comment:

> If the coroutine raises an exception which doesn't inherit from Exception 
> (but inherits from BaseException), run_until_complete() doesn't consume the 
> exception from the temporary task object

I created the issue #22601 for this bug.

--

___
Python tracker 

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



[issue22428] asyncio: KeyboardInterrupt inside a coroutine causes AttributeError

2014-10-10 Thread STINNER Victor

STINNER Victor added the comment:

> => IMO it's an issue in the traceback module. It may catch the AttributeError 
> on the call to linecache.getline().

I created the issue #22599 for this bug.

--

___
Python tracker 

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



[issue22428] asyncio: KeyboardInterrupt inside a coroutine causes AttributeError

2014-09-24 Thread STINNER Victor

STINNER Victor added the comment:

The issue #22480 has been marked as a duplicate of this issue.

--

___
Python tracker 

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



[issue22428] asyncio: KeyboardInterrupt inside a coroutine causes AttributeError

2014-09-17 Thread STINNER Victor

STINNER Victor added the comment:

I see different issues in your example:


* If the coroutine raises an exception which doesn't inherit from Exception 
(but inherits from BaseException), run_until_complete() doesn't consume the 
exception from the temporary task object

=> run_until_complete(coroutine) sets the _log_destroy_pending attribute of the 
temporary Task to False, but this attribute controls the "Task was destroyed 
but it is pending!" warning. The "%s exception was never retrieved" warning is 
controlled by the Future._log_traceback attribute (in Python 3.4+). This 
attribute is set to True in Future.set_exception().*


* If a Task is deleted late during Python shutdown, the logging module fails to 
log the traceback because the builtin function has been deleted.

=> IMO it's an issue in the traceback module. It may catch the AttributeError 
on the call to linecache.getline(). It's not convinient to get a new exception 
(traceback) when trying to display a traceback... Maybe the traceback can check 
if Python is exiting before calling the linecache module?


* If you call again loop.run_forever(): it exits immediatly because a call to 
loop.stop() was scheduled by future.set_exception()

=> I created the issue #22429


I don't think that it's a bug that Task._step() calls set_exception() for 
BaseException. Otherwise, how do you know that a task failed?

--

___
Python tracker 

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



[issue22428] asyncio: KeyboardInterrupt inside a coroutine causes AttributeError

2014-09-17 Thread STINNER Victor

Changes by STINNER Victor :


--
title: KeyboardInterrupt inside a coroutine causes AttributeError -> asyncio: 
KeyboardInterrupt inside a coroutine causes AttributeError

___
Python tracker 

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