diff --git a/README.md b/README.md index d0dc88ca1596e1b0231e2f60aee88be04f2e73e4..6648276e4972a05ba30bcba4d7f91bd8d9c64d59 100644 --- a/README.md +++ b/README.md @@ -51,7 +51,7 @@ Then copy your resulting wheel and install it via pip on the target system. ## v0.6.2 -* _TBA_ +* added the context manager syntax to VarlenIterator ## v0.6.1 diff --git a/setup.cfg b/setup.cfg index 0fdfddeb7f33509ed62cb0d352d13a27abd485c4..1da873475b866fc4f2edc9be5eb58790b1af268f 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,7 +1,7 @@ # coding: utf-8 [metadata] name = tempsdb -version = 0.6.2a1 +version = 0.6.2a2 long-description = file: README.md long-description-content-type = text/markdown; charset=UTF-8 license_files = LICENSE diff --git a/tempsdb/varlen.pyx b/tempsdb/varlen.pyx index f17211ba3e8a480adb4f6a1c0a74ed9df0db8d0a..964b246997854867b4b89644c99cb4281ee75a3b 100644 --- a/tempsdb/varlen.pyx +++ b/tempsdb/varlen.pyx @@ -289,6 +289,8 @@ cdef class VarlenIterator: If you forget to do that, a warning will be issued and the destructor will close it automatically. + Also supports the context manager syntax of :class:`~tempsdb.iterators.Iterator` + :param parent: parent series :param start: started series :param stop: stopped series @@ -388,6 +390,12 @@ cdef class VarlenIterator: else: return varlen_entry.timestamp(), varlen_entry + def __enter__(self): + return self + + def __exit__(self, exc_type, exc_val, exc_tb): + self.close() + def __iter__(self): return self