[issue22572] NoneType object is not iterable error when asyncio Server.close() called

STINNER Victor report at bugs.python.org
Tue Oct 7 11:59:12 CEST 2014


STINNER Victor added the comment:

Oh, I didn't notice that waiter_bug.py does nothing :-) I added "unittest.main()". With PYTHONASYNCIODEBUG=1, I get *two* errors, maybe we don't need to add more checks in debug mode.

Again, maybe the debug mode should be better documented?
https://docs.python.org/dev/library/asyncio-dev.html#debug-mode-of-asyncio

Currently, it's at the end of the documentation.

ERROR:asyncio:<CoroWrapper Server.wait_closed() running at /home/haypo/prog/python/default/Lib/asyncio/base_events.py:143, created at waiter_bug.py:32> was never yielded from
Coroutine object created at (most recent call last):
  File "waiter_bug.py", line 43, in <module>
    unittest.main()
  File "/home/haypo/prog/python/default/Lib/unittest/main.py", line 93, in __init__
    self.runTests()
  File "/home/haypo/prog/python/default/Lib/unittest/main.py", line 244, in runTests
    self.result = testRunner.run(self.test)
  File "/home/haypo/prog/python/default/Lib/unittest/runner.py", line 168, in run
    test(result)
  File "/home/haypo/prog/python/default/Lib/unittest/suite.py", line 87, in __call__
    return self.run(*args, **kwds)
  File "/home/haypo/prog/python/default/Lib/unittest/suite.py", line 125, in run
    test(result)
  File "/home/haypo/prog/python/default/Lib/unittest/suite.py", line 87, in __call__
    return self.run(*args, **kwds)
  File "/home/haypo/prog/python/default/Lib/unittest/suite.py", line 125, in run
    test(result)
  File "/home/haypo/prog/python/default/Lib/unittest/case.py", line 625, in __call__
    return self.run(*args, **kwds)
  File "/home/haypo/prog/python/default/Lib/unittest/case.py", line 582, in run
    self.doCleanups()
  File "/home/haypo/prog/python/default/Lib/unittest/case.py", line 618, in doCleanups
    function(*args, **kwargs)
  File "waiter_bug.py", line 32, in _stop_server
    self.server.wait_closed()
DEBUG:asyncio:Using selector: EpollSelector
E
======================================================================
ERROR: test_version (__main__.Test)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "waiter_bug.py", line 33, in _stop_server
    self.server_loop.stop()
  File "/home/haypo/prog/python/default/Lib/asyncio/base_events.py", line 285, in stop
    self.call_soon(_raise_stop_error)
  File "/home/haypo/prog/python/default/Lib/asyncio/base_events.py", line 373, in call_soon
    handle = self._call_soon(callback, args, check_loop=True)
  File "/home/haypo/prog/python/default/Lib/asyncio/base_events.py", line 382, in _call_soon
    self._assert_is_current_event_loop()
  File "/home/haypo/prog/python/default/Lib/asyncio/base_events.py", line 404, in _assert_is_current_event_loop
    "Non-thread-safe operation invoked on an event loop other "
RuntimeError: Non-thread-safe operation invoked on an event loop other than the current one

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue22572>
_______________________________________


More information about the Python-bugs-list mailing list