From 86cf3eb71c3c4d4c9f2e5cdb5059762f8f851ad9 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Thu, 9 Mar 2017 11:36:19 -0500 Subject: Improve serializer behavior Fix an issue where the Annotated system needs to have a __reduce__ method, also see why we can't default to HIGHEST_PROTOCOL. This latter part might not be a good idea until 1.2 for compatibility reasons. Change-Id: I0239e38259fc768c9e3b6c448c29161e271a969c Fixes: #3918 --- lib/sqlalchemy/sql/annotation.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'lib/sqlalchemy/sql') diff --git a/lib/sqlalchemy/sql/annotation.py b/lib/sqlalchemy/sql/annotation.py index e6f6311c4..6d0eaa1d2 100644 --- a/lib/sqlalchemy/sql/annotation.py +++ b/lib/sqlalchemy/sql/annotation.py @@ -94,6 +94,9 @@ class Annotated(object): clone.__dict__.update(self.__dict__) return self.__class__(clone, self._annotations) + def __reduce__(self): + return self.__class__, (self.__element, self._annotations) + def __hash__(self): return self._hash -- cgit v1.2.1