You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "jorisvandenbossche (via GitHub)" <gi...@apache.org> on 2023/07/20 08:04:31 UTC

[GitHub] [arrow] jorisvandenbossche commented on a diff in pull request #36745: GH-36730: [Python] Add support for Cython 3.0.0

jorisvandenbossche commented on code in PR #36745:
URL: https://github.com/apache/arrow/pull/36745#discussion_r1269095137


##########
python/pyarrow/ipc.pxi:
##########
@@ -437,7 +437,11 @@ cdef class MessageReader(_Weakrefable):
 
     def __iter__(self):
         while True:
-            yield self.read_next_message()
+            try:
+                yield self.read_next_message()
+            except StopIteration:
+                # For Cython >= 3.0.0
+                return

Review Comment:
   I don't know if it is this code that gives problems to be written in a way that works for both cython 0.29 and 3, but a potential different way of writing it:
   
   ```
   def __iter__(self):
       return self
   
   def __next__(self):
       return self.read_next_message()
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org