Message114923
>>> socket.create_connection(('a..com', 25))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/rdmurray/python/py3k/Lib/socket.py", line 300, in create_connection
for res in getaddrinfo(host, port, 0, SOCK_STREAM):
File "/home/rdmurray/python/py3k/Lib/encodings/idna.py", line 167, in encode
result.extend(ToASCII(label))
File "/home/rdmurray/python/py3k/Lib/encodings/idna.py", line 73, in ToASCII
raise UnicodeError("label empty or too long")
UnicodeError: label empty or too long
I have two problems with this: why is it a UnicodeError? (That confused me into going down a blind alley before finding my typo in the original context where I encountered this). The other problem is the term 'label'. I realize this is technically correct and precise, but I doubt most users will recognize it (I didn't remember what it meant until I looked it up). Could we perhaps change it to 'domain name subpart'?
Note that in 2.x this gives 'name or service not known' unless the input string is unicode, in which case it gives the error above. So in 2.x the UnicodeError was at least not totally dissociated from the cause of the error, but still strikes me as sub-optimal. I would expect a ValueError. |
|
Date |
User |
Action |
Args |
2010-08-25 18:08:13 | r.david.murray | set | recipients:
+ r.david.murray, loewis |
2010-08-25 18:08:13 | r.david.murray | set | messageid: <1282759693.65.0.0842882042261.issue9682@psf.upfronthosting.co.za> |
2010-08-25 18:08:11 | r.david.murray | link | issue9682 messages |
2010-08-25 18:08:11 | r.david.murray | create | |
|