[issue27136] sock_connect fails for bluetooth (and probably others)

2016-05-27 Thread pyptr2

Changes by pyptr2 :


Added file: http://bugs.python.org/file43028/test_async_btsock.py

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



[issue27136] sock_connect fails for bluetooth (and probably others)

2016-05-27 Thread pyptr2

Changes by pyptr2 :


--
components: +Library (Lib)
versions: +Python 3.5

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



[issue27136] sock_connect fails for bluetooth (and probably others)

2016-05-27 Thread pyptr2

pyptr2 added the comment:

The test program should try to connect to a bluetooth device, using asyncio.
The bluetooth address is obviously made up, so it would likely fail to do so, 
but it should not raise an exception before even trying:

$ python3.5 test_async_btsock.py 
Traceback (most recent call last):
  File "test_async_btsock.py", line 9, in 
loop.run_until_complete(coro)
  File "/usr/lib/python3.5/asyncio/base_events.py", line 373, in 
run_until_complete
return future.result()
  File "/usr/lib/python3.5/asyncio/futures.py", line 274, in result
raise self._exception
  File "/usr/lib/python3.5/asyncio/selector_events.py", line 400, in 
sock_connect
base_events._check_resolved_address(sock, address)
  File "/usr/lib/python3.5/asyncio/base_events.py", line 151, in 
_check_resolved_address
" got host %r" % host)
ValueError: address must be resolved (IP address), got host '00:01:02:03:04:05'

--

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



[issue27136] sock_connect fails for bluetooth (and probably others)

2016-05-28 Thread pyptr2

pyptr2 added the comment:

Thanks for looking into this. Some comments:

1.
yuri, I haven't tried the github repo. Is that where the development happens? 
The description suggests it is outdated since the adoption, but there are some 
commits that aren't in hg...?
Anyhow, the relevant code looks identical to me.

2.
guido, yes validation would be domain specific.
But, just to understand: why validate at all?
If I give create_connection() or sock_connect() an unresolved address, then I 
would expect some "yield from resolve(domain, name)" to happen, which would be 
getaddrinfo() for IP-domain. If that would hang the event loop on some 
platform, do it in an executor. This is exactly what create_server() already 
does, by the way.

3.
AF_UNPSEC seems to mean (AF_INET or AF_INET6) to a lot of people these days, 
possibly because getaddrinfo() accepts these three AFs. I am not 100% sure, but 
that is why I think it is reasonable that _ipaddr_info() handles AF_UNSPEC in 
the way it does.

4.
For my use case, anything that stops check_resolve() from raising when given a 
resolved non-IP address would be enough for now.

--

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



[issue27136] sock_connect fails for bluetooth (and probably others)

2016-05-27 Thread pyptr2

New submission from pyptr2:

Base{Selector,Proactor}EventLoop each have a sock_connect() method, both of 
which unconditionally "try" to run base_events' _check_resolved_address() which 
is apparently meant to raise an exception when called with an unresolved IP 
hostname. (because on some OSes it cannot be done asynchronously? WTF?)

Anyhow, the current implementation prevents ANY address family other than IP 
(and UNIX, which is special cased) to raise the exception, no matter if it's 
resolved or not.

So please, call _ipaddr_info() for IP only.

--
components: asyncio
files: check_resolved.patch
keywords: patch
messages: 266486
nosy: gvanrossum, haypo, pyptr2, yselivanov
priority: normal
severity: normal
status: open
title: sock_connect fails for bluetooth (and probably others)
type: behavior
versions: Python 3.6
Added file: http://bugs.python.org/file43027/check_resolved.patch

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



[issue27136] sock_connect fails for bluetooth (and probably others)

2016-05-27 Thread pyptr2

pyptr2 added the comment:

s/prevents/causes/

--

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