Closed elliotwutingfeng closed 7 months ago
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.
ulabel(label_bytes)
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.
label
We can simplify label_bytes as _alabel_prefix + _punycode(label).
label_bytes
_alabel_prefix + _punycode(label)
Proposed change
I found some portions of alabel() which are either unreachable or redundant.
is not reachable because an empty string would be caught by
ulabel(label_bytes)
in the preceding try-block.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)
.