This is an automated email from the ASF dual-hosted git repository.
github-merge-queue[bot] pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/iceberg-python.git
The following commit(s) were added to refs/heads/main by this push:
new b32392dcb Avro: Replace manual slots with dataclass slots (#4091)
b32392dcb is described below
commit b32392dcbafd3b92415a5b5dc0444722ca2091d9
Author: Mohamed Laghdaf Dadda <[email protected]>
AuthorDate: Sat Oct 10 12:38:16 2026 +0000
Avro: Replace manual slots with dataclass slots (#4091)
Use slots=True for ListReader and MapReader instead of
manually declaring __slots__.
Preserve the original dataclass fields and use two-argument
super() for compatibility with slotted dataclasses.
Internal cached attributes now use the inherited instance
dictionary instead of dedicated slots.
Refs #4086
---
pyiceberg/avro/reader.py | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/pyiceberg/avro/reader.py b/pyiceberg/avro/reader.py
index cf8e5154e..e3ee8305f 100644
--- a/pyiceberg/avro/reader.py
+++ b/pyiceberg/avro/reader.py
@@ -380,13 +380,12 @@ class StructReader(Reader):
return self._hash
-@dataclass(frozen=False, init=False)
+@dataclass(frozen=False, init=False, slots=True)
class ListReader(Reader):
- __slots__ = ("element", "_is_int_list", "_hash")
element: Reader
def __init__(self, element: Reader) -> None:
- super().__init__()
+ super(ListReader, self).__init__()
self.element = element
self._hash = hash(self.element)
self._is_int_list = isinstance(self.element, IntegerReader)
@@ -418,14 +417,13 @@ class ListReader(Reader):
EMPTY_DICT: dict[Any, Any] = {}
-@dataclass(frozen=False, init=False)
+@dataclass(frozen=False, init=False, slots=True)
class MapReader(Reader):
- __slots__ = ("key", "value", "_is_int_int", "_is_int_bytes",
"_key_reader", "_value_reader", "_hash")
key: Reader
value: Reader
def __init__(self, key: Reader, value: Reader) -> None:
- super().__init__()
+ super(MapReader, self).__init__()
self.key = key
self.value = value
if isinstance(self.key, IntegerReader):