[issue22922] asyncio: call_soon() should raise an exception if the event loop is closed

2015-01-13 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 6c473f82309d by Victor Stinner in branch '3.4':
Issue #22922: Fix ProactorEventLoop.close()
https://hg.python.org/cpython/rev/6c473f82309d

--

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



[issue22922] asyncio: call_soon() should raise an exception if the event loop is closed

2014-12-16 Thread STINNER Victor

STINNER Victor added the comment:

 Windows buildbots are not happy:

test_asyncio pass again on Windows buildbots, I close the issue.

--
resolution:  - fixed
status: open - closed

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



[issue22922] asyncio: call_soon() should raise an exception if the event loop is closed

2014-12-04 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 226f870b387d by Victor Stinner in branch '3.4':
Closes #22922: More EventLoop methods fail if the loop is closed. Initial patch
https://hg.python.org/cpython/rev/226f870b387d

--
nosy: +python-dev
resolution:  - fixed
stage:  - resolved
status: open - closed

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



[issue22922] asyncio: call_soon() should raise an exception if the event loop is closed

2014-12-04 Thread STINNER Victor

STINNER Victor added the comment:

I didn't change subprocess_exec() nor subprocess_shell() because they are 
coroutine. A coroutine object can only raise an exception when they are 
executed, whereas a closed loop cannot execute a coroutine object. I modified 
create_task() to fail if the event loop is closed, it should be enough.

Thanks Torsten Landschoff for your fix.

--

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



[issue22922] asyncio: call_soon() should raise an exception if the event loop is closed

2014-12-04 Thread STINNER Victor

STINNER Victor added the comment:

Windows buildbots are not happy:

http://buildbot.python.org/all/builders/AMD64%20Windows7%20SP1%203.x/builds/5385/steps/test/logs/stdio


==
ERROR: test_close (test.test_asyncio.test_windows_events.ProactorTests)
--
Traceback (most recent call last):
  File 
C:\buildbot.python.org\3.x.kloth-win64\build\lib\asyncio\proactor_events.py, 
line 394, in close
self._close_self_pipe()
  File 
C:\buildbot.python.org\3.x.kloth-win64\build\lib\asyncio\proactor_events.py, 
line 423, in _close_self_pipe
self._self_reading_future.cancel()
  File 
C:\buildbot.python.org\3.x.kloth-win64\build\lib\asyncio\windows_events.py, 
line 70, in cancel
return super().cancel()
  File C:\buildbot.python.org\3.x.kloth-win64\build\lib\asyncio\futures.py, 
line 230, in cancel
self._schedule_callbacks()
  File C:\buildbot.python.org\3.x.kloth-win64\build\lib\asyncio\futures.py, 
line 245, in _schedule_callbacks
self._loop.call_soon(callback, self)
  File 
C:\buildbot.python.org\3.x.kloth-win64\build\lib\asyncio\base_events.py, line 
384, in call_soon
handle = self._call_soon(callback, args, check_loop=True)
  File 
C:\buildbot.python.org\3.x.kloth-win64\build\lib\asyncio\base_events.py, line 
395, in _call_soon
self._check_closed()
  File 
C:\buildbot.python.org\3.x.kloth-win64\build\lib\asyncio\base_events.py, line 
234, in _check_closed
raise RuntimeError('Event loop is closed')
RuntimeError: Event loop is closed

--
resolution: fixed - 
status: closed - open

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



[issue22922] asyncio: call_soon() should raise an exception if the event loop is closed

2014-12-04 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 6a955db1f78f by Victor Stinner in branch 'default':
Issue #22922: Fix ProactorEventLoop.close()
https://hg.python.org/cpython/rev/6a955db1f78f

--

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



[issue22922] asyncio: call_soon() should raise an exception if the event loop is closed

2014-12-04 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 0a7d956a2f2d by Victor Stinner in branch '3.4':
Issue #22922: Fix ProactorEventLoop.close()
https://hg.python.org/cpython/rev/0a7d956a2f2d

--

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



[issue22922] asyncio: call_soon() should raise an exception if the event loop is closed

2014-11-28 Thread STINNER Victor

STINNER Victor added the comment:

call_soon_after_close.diff looks good but also incomplete: call_later, call_at 
and run_in_executor should also raise an exception if the event loop is closed.

You should also add call_soon_threadsafe to the test.

 So for consistency this patch should grow quite a bit (unless 
 create_connection, add_reader etc. already raise in this case).

Yes, add_reader raises an exception and there is an unit test to ensure that.

create_task() is a little bit special, it does not schedule immediatly a 
coroutine. IMO it makes sense to fail if the loop was closed, I don't see how 
the task can be executed if the loop was executed, so calling create_task() on 
a closed loop looks like a bug.

I suggest to modify the following methods:
- call_soon, call_soon_threadsafe
- call_at, call_later
- run_in_executor
- create_task
- add_signal_handler
- subprocess_exec, subprocess_shell

Did I miss something?

I'm not sure that *all* asyncio methods should must call _check_closed(), it 
may make the code harder to read. If the basic functions like call_soon and 
add_reader already handle the closed status, I guess that all other methods 
will fail loudly, so they don't need to be modified.

For example, stop() calls call_soon() and so will also raises an exception if 
the loop is closed.

Maybe we should add almost all methods to the test checking that calling these 
methods on a closed loop fail.

--

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



[issue22922] asyncio: call_soon() should raise an exception if the event loop is closed

2014-11-28 Thread Terry J. Reedy

Terry J. Reedy added the comment:

Adding minimal code checks to make multiple tests pass sounds good to me.

--
nosy: +terry.reedy

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



[issue22922] asyncio: call_soon() should raise an exception if the event loop is closed

2014-11-27 Thread Torsten Landschoff

Torsten Landschoff added the comment:

If anybody cares, here is a small patch to implement this. I ran the test suite 
and nothing else fails because of this change.

However I wonder if this is a slippery slope to go: If call_soon raises after 
the event loop is closed than everything else that registers an action with the 
loop should raise as well.

So for consistency this patch should grow quite a bit (unless 
create_connection, add_reader etc. already raise in this case).

If the decision is to go this path I would also suggest to add a new exception 
type for Event loop is closed so that it can be caught in client code.

YMMV

--
keywords: +patch
nosy: +torsten
Added file: http://bugs.python.org/file37298/call_soon_after_close.diff

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



[issue22922] asyncio: call_soon() should raise an exception if the event loop is closed

2014-11-27 Thread STINNER Victor

STINNER Victor added the comment:

 If the decision is to go this path I would also suggest to add a new 
 exception type for Event loop is closed so that it can be caught in client 
 code.

I don't see the purpose of handling such exception. It's an obvious
bug, you must not handle bugs :)

--

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



[issue22922] asyncio: call_soon() should raise an exception if the event loop is closed

2014-11-27 Thread Torsten Landschoff

Torsten Landschoff added the comment:

  If the decision is to go this path I would also suggest to add a new 
  exception type for Event loop is closed so that it can be caught in 
  client code.

 I don't see the purpose of handling such exception. It's an obvious
bug, you must not handle bugs :)

Unless you can't directly fix them. They might be inside a library and 
triggered during application shutdown.

--

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



[issue22922] asyncio: call_soon() should raise an exception if the event loop is closed

2014-11-27 Thread STINNER Victor

STINNER Victor added the comment:

 They might be inside a library and triggered during application shutdown.

In this case, fix the library.

--

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



[issue22922] asyncio: call_soon() should raise an exception if the event loop is closed

2014-11-23 Thread STINNER Victor

New submission from STINNER Victor:

call_soon() call be called before the event loop starts and after 
run_forever(), the call will be executed by the next call to run_forever() (or 
run_until_complete).

But calling call_soon() after close() does not make sense and the user may be 
surprised to not see its function called. It can be obvious in a simple 
program, but not in a large application.

--
components: asyncio
keywords: easy
messages: 231549
nosy: gvanrossum, haypo, yselivanov
priority: normal
severity: normal
status: open
title: asyncio: call_soon() should raise an exception if the event loop is 
closed
versions: Python 3.4, Python 3.5

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