]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
fix
authorAlbert N <anamaev263@gmail.com>
Thu, 16 Oct 2025 16:55:31 +0000 (16:55 +0000)
committerAlbert N <anamaev263@gmail.com>
Thu, 16 Oct 2025 16:55:31 +0000 (16:55 +0000)
lib/sqlalchemy/engine/_row_cy.py

index 7e821c35faf73007c2b8cbed77b34e8d95d1333f..6fea91ceee60569700d3b287a00b2b4e371aeccb 100644 (file)
@@ -51,9 +51,6 @@ if not cython.compiled:
     def PyTuple_SET_ITEM(tup, idx, item):  # type: ignore
         tup[idx] = item
 
-    def _getstate_impl(cls: object) -> dict:
-        return {"_parent": cls._parent, "_data": cls._data}
-
     def _apply_processors(
         proc: _ProcessorsType, data: Sequence[Any]
     ) -> Tuple[Any, ...]:
@@ -167,22 +164,31 @@ class BaseRow:
             object.__setattr__(self, "_key_to_index", key_to_index)
             object.__setattr__(self, "_data", data)
 
-    def __reduce__(self) -> Tuple[Any, Any]:
-        return (
-            rowproxy_reconstructor,
-            (self.__class__, self._getstate_impl()),
-        )
-
     if cython.compiled:
 
         def __getstate__(self) -> Dict[str, Any]:
             return self._getstate_impl()
 
+        def __reduce__(self) -> Tuple[Any, Any]:
+            return (
+                rowproxy_reconstructor,
+                (self.__class__, self._getstate_impl()),
+            )
+
     else:
 
         def __getstate__(self) -> Dict[str, Any]:
             return {"_parent": self._parent, "_data": self._data}
 
+        def __reduce__(self) -> Tuple[Any, Any]:
+            return (
+                rowproxy_reconstructor,
+                (
+                    self.__class__,
+                    {"_parent": self._parent, "_data": self._data},
+                ),
+            )
+
     def __setstate__(self, state: Dict[str, Any]) -> None:
         parent = state["_parent"]
         self._set_attrs(parent, parent._key_to_index, state["_data"])