Message260857
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. |
|
Date |
User |
Action |
Args |
2016-02-25 13:51:59 | xdegaye | set | recipients:
+ xdegaye, gvanrossum, pitrou, vstinner, giampaolo.rodola, yselivanov |
2016-02-25 13:51:59 | xdegaye | set | messageid: <1456408319.2.0.804697554696.issue26437@psf.upfronthosting.co.za> |
2016-02-25 13:51:59 | xdegaye | link | issue26437 messages |
2016-02-25 13:51:58 | xdegaye | create | |
|