vhf/confusable_homoglyphs

TypeError: 'NoneType' object is not iterable

rominf opened this issue · 4 comments

With the latest version:

In [1]: import confusable_homoglyphs.confusables

In [2]: confusable_homoglyphs.confusables.is_dangerous(string='Їt', preferred_aliases=['latin'])
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-5-a295e9ba12b9> in <module>()
----> 1 confusable_homoglyphs.confusables.is_dangerous(string='Їt', preferred_aliases=['latin'])

~/.pyenv/versions/3.7.0/envs/kamabot/lib/python3.7/site-packages/confusable_homoglyphs/confusables.py in is_dangerous(string, preferred_aliases)
    158     :rtype: bool
    159     """
--> 160     return is_mixed_script(string) and is_confusable(string, preferred_aliases=preferred_aliases)

~/.pyenv/versions/3.7.0/envs/kamabot/lib/python3.7/site-packages/confusable_homoglyphs/confusables.py in is_confusable(string, greedy, preferred_aliases)
    109             potentially_confusable = []
    110             try:
--> 111                 for d in found:
    112                     aliases = [alias(glyph) for glyph in d['c']]
    113                     for a in aliases:

TypeError: 'NoneType' object is not iterable
vhf commented

Good catch @rominf ! I'll fix it shortly

vhf commented

@rominf Released as 3.2.0

@vhf Thank you. Now it doesn't raise the exception.

But this line now returns False. That's not correct: 'Їt' is confusable with 'It'.

vhf commented

Is it? Could you please point me to the relevant Unicode source?

Could you please check that it is present in this file: ftp://ftp.unicode.org/Public/security/latest/confusables.txt ?