[issue26936] android: test_socket fails

2016-05-03 Thread Xavier de Gaye

New submission from Xavier de Gaye:

test_socket fails on an android emulator running an x86 system image at API 
level 21.


==
ERROR: testGetServBy (test.test_socket.GeneralModuleTests)
--
Traceback (most recent call last):
  File "/sdcard/org.bitbucket.pyona/lib/python3.6/test/test_socket.py", line 
913, in testGetServBy
port2 = socket.getservbyname(service)
OSError: service/proto not found

==
ERROR: testGetaddrinfo (test.test_socket.GeneralModuleTests)
--
Traceback (most recent call last):
  File "/sdcard/org.bitbucket.pyona/lib/python3.6/test/test_socket.py", line 
1240, in testGetaddrinfo
socket.getaddrinfo(HOST, "http")
  File "/sdcard/org.bitbucket.pyona/lib/python3.6/socket.py", line 732, in 
getaddrinfo
for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno 9] servname not supported for ai_socktype

--
Ran 530 tests in 26.702s

FAILED (errors=2, skipped=75)
test test_socket failed
1 test failed:
test_socket
Total duration: 0:00:27

--
components: Cross-Build, Library (Lib)
messages: 264737
nosy: Alex.Willmer, xdegaye
priority: normal
severity: normal
status: open
title: android: test_socket fails
type: behavior
versions: Python 3.6

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue26936] android: test_socket fails

2016-05-07 Thread Xavier de Gaye

Xavier de Gaye added the comment:

On android getservbyname(const char *NAME, const char *PROTO) returns NULL when 
PROTO is NULL:

root@generic_x86:/data/local/tmp # python
Python 3.6.0a0 (default:811ccdee6f87+, May  7 2016, 17:56:37) 
[GCC 4.9 20140827 (prerelease)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import socket
>>> socket.getservbyname('daytime', 'tcp')
13
>>> socket.getservbyname('daytime', 'udp')
13
>>> socket.getservbyname('daytime')
Traceback (most recent call last):
  File "", line 1, in 
OSError: service/proto not found
>>> 


On android socket.getaddrinfo() raises an exception when port is not a number:

>>> socket.getaddrinfo('127.0.0.1', 80)
[(, , 17, '', ('127.0.0.1', 
80)), (, , 6, '', 
('127.0.0.1', 80))]
>>> socket.getaddrinfo('127.0.0.1', 'http')
Traceback (most recent call last):
  File "", line 1, in 
  File "/sdcard/org.bitbucket.pyona/lib/python3.6/socket.py", line 732, in 
getaddrinfo
for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno 9] servname not supported for ai_socktype
>>>

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue26936] android: test_socket fails

2016-05-10 Thread Xavier de Gaye

Xavier de Gaye added the comment:

testGetaddrinfo does not fail anymore on an emulator running an android-23-x86, 
i.e. Android 6.0 or API 23.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue26936] android: test_socket fails

2016-05-25 Thread Xavier de Gaye

Xavier de Gaye added the comment:

This patch fixes the testGetServBy test for API 21 and 23 (fixing the cases a) 
and e) of my previous msg).

--
keywords: +patch
Added file: http://bugs.python.org/file43000/null-proto.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue26936] android: test_socket fails

2016-05-25 Thread Xavier de Gaye

Xavier de Gaye added the comment:

Problems with the socket module on Android:
API 21:
a) Both getservbyname() and getservbyport() fail when the optional 
'protocolname' parameter is not set to 'tcp' or 'udp'.
b) getservbyname() fails when 'servicename' is set to 'http'.
getaddrinfo() fails either when:
c) 'port' is 'http'.
d) Or the optional 'type' is not set to socket.SOCK_STREAM or 
socket.SOCK_DGRAM and 'port' is a string.

API 23:
e) getservbyport() fails when the optional 'protocolname' parameter is not 
set to 'tcp' or 'udp'.

IMHO case b) and c) are difficult to fix.
For case d), one could use the Python implementation of getaddrinfo, but 
Android does not have the deprecated getipnodebyaddr(), so it is necessary to 
disable ipv6 in this case. Not sure if this is worth it.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue26936] android: test_socket fails

2016-05-25 Thread Xavier de Gaye

Xavier de Gaye added the comment:

This patch fixes the testGetaddrinfo test for API 21 (the test runs fine on API 
23):
The failing statement 'socket.getaddrinfo(HOST, "http")' in testGetaddrinfo 
does not test explicitly for "http" and for the absence of the optional 'type' 
parameter.
When is_android is True, the 'socket.getaddrinfo('127.0.0.1', "echo", 
type=socket.SOCK_DGRAM)' statement is run instead and the test is ok.

--
dependencies: +add is_android in test.support to detect Android platform
Added file: http://bugs.python.org/file43001/test-getaddrinfo.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue26936] android: test_socket fails

2017-03-31 Thread Donald Stufft

Changes by Donald Stufft :


--
pull_requests: +1025

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue26936] android: test_socket fails

2016-10-30 Thread Xavier de Gaye

Xavier de Gaye added the comment:

This patch simply skips the statements that fail on Android.

--
assignee:  -> xdegaye
components: +Tests -Cross-Build, Library (Lib)
stage:  -> patch review
versions: +Python 3.7
Added file: http://bugs.python.org/file45278/test_socket.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue26936] android: test_socket fails

2016-10-31 Thread Xavier de Gaye

Xavier de Gaye added the comment:

Entered https://code.google.com/p/android/issues/detail?id=226677 on the AOSP 
issue tracker.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue26936] android: test_socket fails

2016-11-18 Thread Xavier de Gaye

Xavier de Gaye added the comment:

New patch using support.less_than_android_api(level).

--
stage: patch review -> commit review
Added file: http://bugs.python.org/file45534/test_socket_2.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue26936] android: test_socket fails

2016-12-12 Thread Xavier de Gaye

Xavier de Gaye added the comment:

New patch using sys.getandroidapilevel().
getandroidapilevel() is only available in 3.7, so only 3.7 is being fixed.

--
stage: commit review -> patch review
versions:  -Python 3.6
Added file: http://bugs.python.org/file45858/test_socket_3.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue26936] android: test_socket fails

2016-12-13 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 95140ff32239 by Xavier de Gaye in branch 'default':
Issue #26936: Fix the test_socket failures on Android - getservbyname(),
https://hg.python.org/cpython/rev/95140ff32239

--
nosy: +python-dev

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue26936] android: test_socket fails

2016-12-13 Thread Xavier de Gaye

Changes by Xavier de Gaye :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com