Author: Armin Rigo <[email protected]>
Branch: py3.5
Changeset: r89302:724153585911
Date: 2017-01-02 16:51 +0100
http://bitbucket.org/pypy/pypy/changeset/724153585911/
Log: gethostbyname_ex(): support for the 'idna' encoding
diff --git a/pypy/module/_socket/interp_func.py
b/pypy/module/_socket/interp_func.py
--- a/pypy/module/_socket/interp_func.py
+++ b/pypy/module/_socket/interp_func.py
@@ -45,13 +45,13 @@
space.newlist(aliases),
space.newlist(address_list)])
-@unwrap_spec(host=str)
-def gethostbyname_ex(space, host):
+def gethostbyname_ex(space, w_host):
"""gethostbyname_ex(host) -> (name, aliaslist, addresslist)
Return the true host name, a list of aliases, and a list of IP addresses,
for a host. The host argument is a string giving a host name or IP number.
"""
+ host = encode_idna(space, w_host)
try:
res = rsocket.gethostbyname_ex(host)
except SocketError as e:
diff --git a/pypy/module/_socket/test/test_sock_app.py
b/pypy/module/_socket/test/test_sock_app.py
--- a/pypy/module/_socket/test/test_sock_app.py
+++ b/pypy/module/_socket/test/test_sock_app.py
@@ -686,6 +686,7 @@
import _socket
domain =
u"испытание.pythontest.net"
_socket.gethostbyname(domain)
+ _socket.gethostbyname_ex(domain)
class AppTestNetlink:
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit