idna icon indicating copy to clipboard operation
idna copied to clipboard

Remove redundant steps in alabel()

Open elliotwutingfeng opened this issue 1 year ago • 0 comments

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).

elliotwutingfeng avatar Nov 22 '23 23:11 elliotwutingfeng