Skip to content

Commit d230a8a

Browse files
committed
fix
1 parent ecacb30 commit d230a8a

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

faster_ens/_normalization.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -609,7 +609,7 @@ def NFC(unistr: str) -> str:
609609
return "".join(map(chr, _compose(list(map(ord, NFD(unistr))))))
610610

611611

612-
def _compose(elements: List[int]) -> List[int]:
612+
def _compose(elements_: List[int]) -> List[int]:
613613
# Canonical composition algorithm to transform a fully decomposed
614614
# and canonically ordered string into its most fully composed but still
615615
# canonically equivalent sequence.
@@ -619,14 +619,15 @@ def _compose(elements: List[int]) -> List[int]:
619619
composite_by_cdecomp = _COMPOSITE_BY_CDECOMP
620620
composition_exclusions = _COMPOSITION_EXCLUSIONS
621621

622+
elements: List[Optional[int]] = elements_.copy()
622623
for i, x in enumerate(elements):
623-
if x in non_zero_table:
624+
if x is None or x in non_zero_table:
624625
continue
625626

626627
last_cc = False
627628
blocked = False
628629

629-
for j, y in enumerate(elements[i + 1 :], i + 1):
630+
for j, y in enumerate(cast(List[int], elements[i + 1 :]), i + 1):
630631
if y in non_zero_table:
631632
last_cc = True
632633
else:

0 commit comments

Comments
 (0)