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

fokko pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/iceberg.git


The following commit(s) were added to refs/heads/master by this push:
     new c1fc550225 Python: Close the file handler (#8329)
c1fc550225 is described below

commit c1fc55022557653cfeb6125c1d51bf8ab12c8f96
Author: Fokko Driesprong <[email protected]>
AuthorDate: Wed Aug 16 08:45:03 2023 +0200

    Python: Close the file handler (#8329)
---
 python/pyiceberg/avro/file.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/python/pyiceberg/avro/file.py b/python/pyiceberg/avro/file.py
index de71206919..46b5ece890 100644
--- a/python/pyiceberg/avro/file.py
+++ b/python/pyiceberg/avro/file.py
@@ -165,7 +165,8 @@ class AvroFile(Generic[D]):
         Returns:
             A generator returning the AvroStructs.
         """
-        self.decoder = CythonBinaryDecoder(self.input_file.open().read())
+        with self.input_file.open() as f:
+            self.decoder = CythonBinaryDecoder(f.read())
         self.header = self._read_header()
         self.schema = self.header.get_schema()
         if not self.read_schema:

Reply via email to