New submission from Xavier de Gaye: create_server() used to accept the 'port' parameter as a string before in all cases (until last december at least). The following session shows the difference in behavior when the listening address is INADDR_ANY and '127.0.0.1':
============================ $ python Python 3.6.0a0 (default:47fa003aa9f1, Feb 24 2016, 13:09:02) [GCC 5.3.0] on linux Type "help", "copyright", "credits" or "license" for more information. >>> 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=('0.0.0.0', 12345)>, <socket.socket fd=9, family=AddressFamily.AF_INET6, type=2049, proto=6, laddr=('::', 12345, 0, 0)>]> >>> coro = loop.create_server(Protocol(), '127.0.0.1', '12345') >>> loop.run_until_complete(coro) Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/local/lib/python3.6/asyncio/base_events.py", line 373, in run_until_complete return future.result() File "/usr/local/lib/python3.6/asyncio/futures.py", line 274, in result raise self._exception File "/usr/local/lib/python3.6/asyncio/tasks.py", line 240, in _step result = coro.send(None) File "/usr/local/lib/python3.6/asyncio/base_events.py", line 946, in create_server sock.bind(sa) TypeError: an integer is required (got type str) ============================ IMPHO python should consistently either accept 'port' as str or require 'port' as int. ---------- components: Library (Lib) messages: 260857 nosy: giampaolo.rodola, gvanrossum, haypo, pitrou, xdegaye, yselivanov priority: normal severity: normal status: open title: asyncio create_server() not always accepts the 'port' parameter as str type: behavior versions: Python 3.6 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue26437> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com