This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author r.david.murray
Recipients loewis, r.david.murray
Date 2010-08-25.18:08:11
SpamBayes Score 1.6536772e-13
Marked as misclassified No
Message-id <1282759693.65.0.0842882042261.issue9682@psf.upfronthosting.co.za>
In-reply-to
Content
>>> 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.
History
Date User Action Args
2010-08-25 18:08:13r.david.murraysetrecipients: + r.david.murray, loewis
2010-08-25 18:08:13r.david.murraysetmessageid: <1282759693.65.0.0842882042261.issue9682@psf.upfronthosting.co.za>
2010-08-25 18:08:11r.david.murraylinkissue9682 messages
2010-08-25 18:08:11r.david.murraycreate