Skip to content

IndexError with new trailing hyphen check #82

@john-kurkowski

Description

@john-kurkowski

#64 introduced the following uncaught exception. Is this intended?

>>> idna.ulabel('xn--')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/John/.pyenv/versions/3.6.5/Python.framework/Versions/3.6/lib/python3.6/site-packages/idna/core.py", line 303, in ulabel
    if label.decode('ascii')[-1] == '-':
IndexError: string index out of range

I would've expected UnicodeError or IDNAError, which are more descriptive.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions