K 10 svn:author V 4 ngie K 8 svn:date V 27 2019-04-23T22:37:49.390697Z K 7 svn:log V 909 KATParser: don't leak `self.fp` As noted by the python 3 interpreter, self.fp is leaked every time KATParser is called (it raises a `ResourceWarning`). Refactor KATParser in order to not leak `self.fp`: * Don't allocate `self.fp` in `__init__()`. Doing so requires adding `self.fp.close()`, and as noted before, makes for very fragile code when the interpreter is tearing down objects (it can result in crashes in some interpreter versions if triggered with the right conditions). Limit `self.fp` allocation/use to context suites ("the with statement") instead, as this is more likely to not cause non-deterministic weirdness issues with the interpreter. * Rename `__iter__` to `__next__` as it was providing `__next__` support and return the KATParser object instead with `__iter__`, as `__iter__` is meant to return an iterator and `__next__` is meant to help iterate over an iterator. END