From b6e842589151695c80af205690356881ee839083 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Wed, 22 Jun 2022 13:52:31 -0700 Subject: [PATCH] Update __init__.py With the change in the python 3 release 7 the yield function started to work differently, hence this adaption is made. Thank you --- pattern/text/__init__.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pattern/text/__init__.py b/pattern/text/__init__.py index aa77af0b..44517287 100644 --- a/pattern/text/__init__.py +++ b/pattern/text/__init__.py @@ -605,8 +605,11 @@ def _read(path, encoding="utf-8", comment=";;;"): line = decode_utf8(line, encoding) if not line or (comment and line.startswith(comment)): continue - yield line - raise StopIteration + try: + yield line + except StopIteration: + return + return class Lexicon(lazydict):