Skip to content

Commit c5b6937

Browse files
authored
Revert changes to super.__init__()
Attempting to assign values to the attributes directly resulted in write errors.
1 parent 63793fd commit c5b6937

File tree

1 file changed

+5
-5
lines changed
  • packages/db-dtypes/db_dtypes

1 file changed

+5
-5
lines changed

packages/db-dtypes/db_dtypes/core.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,12 @@ def __init__(self, values, dtype=None, copy: bool = False):
6565
elif copy:
6666
values = values.copy()
6767

68-
# 1. Assign the internal attributes required by NDArrayBackedExtensionArray
69-
self._ndarray = values
70-
self._dtype = values.dtype
68+
# We must pass values and dtype to the base constructor.
69+
# Manual assignment (self._ndarray = values) will fail at runtime with
70+
# AttributeError because the base is a Cython-backed 'NDArrayBacked'
71+
# object with non-writable attributes.
72+
super().__init__(values=values, dtype=values.dtype) # type: ignore[call-arg]
7173

72-
# 2. Call super() without arguments to initialize PandasObject/ExtensionArray
73-
super().__init__()
7474

7575
@classmethod
7676
def __ndarray(cls, scalars):

0 commit comments

Comments
 (0)