[docs] [issue26437] asyncio create_server() not always accepts the 'port' parameter as str

Berker Peksag report at bugs.python.org
Wed Jun 8 07:01:06 EDT 2016

Berker Peksag added the comment:

After changeset 3ec208c01418 this is no longer an issue:

>>> from asyncio import *
>>> loop = get_event_loop()
>>> coro = loop.create_server(Protocol(), '', '12345')
>>> loop.run_until_complete(coro)
<Server sockets=[<socket.socket fd=7, family=AddressFamily.AF_INET, type=2049, proto=6, laddr=('', 
>>> coro = loop.create_server(Protocol(), '', '12345')
>>> loop.run_until_complete(coro)
Traceback (most recent call last):
  File "/home/berker/projects/cpython/default/Lib/asyncio/base_events.py", line 981, in create_server
OSError: [Errno 98] Address already in use

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/berker/projects/cpython/default/Lib/asyncio/base_events.py", line 404, in run_until_complete
    return future.result()
  File "/home/berker/projects/cpython/default/Lib/asyncio/futures.py", line 274, in result
    raise self._exception
  File "/home/berker/projects/cpython/default/Lib/asyncio/tasks.py", line 240, in _step
    result = coro.send(None)
  File "/home/berker/projects/cpython/default/Lib/asyncio/base_events.py", line 985, in create_server
    % (sa, err.strerror.lower()))
OSError: [Errno 98] error while attempting to bind on address ('', 12345): address already in use

The traceback looks a bit noisy though. Perhaps it needs ``... from None`` or something like that.

nosy: +berker.peksag
resolution:  -> out of date
stage:  -> resolved
status: open -> closed

Python tracker <report at bugs.python.org>

More information about the docs mailing list