idna
idna copied to clipboard
Remove redundant steps in alabel()
Proposed change
I found some portions of alabel() which are either unreachable or redundant.
if not label:
raise IDNAError('No Input')
is not reachable because an empty string would be caught by ulabel(label_bytes)
in the preceding try-block.
label = str(label)
is redundant as label
is already a str, if it was not a str it would have been caught by the preceding try-block.
We can simplify label_bytes
as _alabel_prefix + _punycode(label)
.