This is an automated email from the ASF dual-hosted git repository.

paleolimbot pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow-nanoarrow.git


The following commit(s) were added to refs/heads/main by this push:
     new 1e596f7  fix(python): Ensure generator does not raise `StopIteration` 
(#262)
1e596f7 is described below

commit 1e596f70ac6d9f7daba8cc19fe5ca0ed3ea0bb9f
Author: Dewey Dunnington <[email protected]>
AuthorDate: Wed Jul 19 11:01:50 2023 -0300

    fix(python): Ensure generator does not raise `StopIteration` (#262)
    
    As noted in #258, the Python tests are failing! I'm not sure the details
    of why this started now, but `StopIteration` was being raised in a
    generator which should just return instead.
---
 python/src/nanoarrow/_lib.pyx | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/python/src/nanoarrow/_lib.pyx b/python/src/nanoarrow/_lib.pyx
index b5210e3..84582b2 100644
--- a/python/src/nanoarrow/_lib.pyx
+++ b/python/src/nanoarrow/_lib.pyx
@@ -894,8 +894,11 @@ cdef class ArrayStream:
             return array
 
     def __iter__(self):
-        while True:
-            yield self.get_next()
+        try:
+            while True:
+                yield self.get_next()
+        except StopIteration:
+            return
 
     @staticmethod
     def allocate():

Reply via email to