Without this fix, UnicodeError exception was raised instead of
LabelTooLong
c == u'\uff0e' or c == u'\uff61':
if len(label) == 0:
raise EmptyLabel
+ if len(label) > 63:
+ # otherwise encodings.idna raises UnicodeError later
+ raise LabelTooLong
labels.append(encodings.idna.ToASCII(label))
label = u''
elif c == u'\\':
label += c
if escaping:
raise BadEscape
+ if len(label) > 63:
+ # otherwise encodings.idna raises UnicodeError later
+ raise LabelTooLong
if len(label) > 0:
labels.append(encodings.idna.ToASCII(label))
else: