X-Git-Url: https://git.notmuchmail.org/git?a=blobdiff_plain;f=bindings%2Fpython%2Fnotmuch%2Ffilename.py;h=de4d785ad6085ddfd3fbf42ebe54ae33d5ca76c7;hb=1915c14a3a0f947629687c686391d99ac9d3a988;hp=630886d7977f1578786f5f60a4e0dcb306b926ec;hpb=8176326f30e654ab4063d437ada6b9f42c1aff0e;p=notmuch diff --git a/bindings/python/notmuch/filename.py b/bindings/python/notmuch/filename.py index 630886d7..de4d785a 100644 --- a/bindings/python/notmuch/filename.py +++ b/bindings/python/notmuch/filename.py @@ -68,7 +68,7 @@ class Filenames(object): once all derived objects are dead. """ if files_p is None: - NotmuchError(STATUS.NULL_POINTER) + raise NotmuchError(STATUS.NULL_POINTER) self._files = files_p #save reference to parent object so we keep it alive @@ -82,13 +82,11 @@ class Filenames(object): if self._files is None: raise NotmuchError(STATUS.NOT_INITIALIZED) - if not nmlib.notmuch_filenames_valid(self._files): - self._files = None - return + while nmlib.notmuch_filenames_valid(self._files): + yield Filenames._get(self._files) + nmlib.notmuch_filenames_move_to_next(self._files) - file = Filenames._get(self._files) - nmlib.notmuch_filenames_move_to_next(self._files) - yield file + self._files = None def __str__(self): """Represent Filenames() as newline-separated list of full paths