diff options
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/sqlalchemy/ext/mutable.py | 14 | ||||
| -rw-r--r-- | lib/sqlalchemy/testing/util.py | 2 |
2 files changed, 9 insertions, 7 deletions
diff --git a/lib/sqlalchemy/ext/mutable.py b/lib/sqlalchemy/ext/mutable.py index eb813a9e8..6a7ffd440 100644 --- a/lib/sqlalchemy/ext/mutable.py +++ b/lib/sqlalchemy/ext/mutable.py @@ -771,6 +771,14 @@ class MutableList(Mutable, list): """ + def __reduce_ex__(self, proto): + return (self.__class__, (list(self),)) + + # needed for backwards compatibility with + # older pickles + def __setstate__(self, state): + self[:] = state + def __setitem__(self, index, value): """Detect list set events and emit change events.""" list.__setitem__(self, index, value) @@ -838,12 +846,6 @@ class MutableList(Mutable, list): else: return value - def __getstate__(self): - return list(self) - - def __setstate__(self, state): - self[:] = state - class MutableSet(Mutable, set): """A set type that implements :class:`.Mutable`. diff --git a/lib/sqlalchemy/testing/util.py b/lib/sqlalchemy/testing/util.py index 7a2aa6027..219511ea0 100644 --- a/lib/sqlalchemy/testing/util.py +++ b/lib/sqlalchemy/testing/util.py @@ -62,7 +62,7 @@ def picklers(): # yes, this thing needs this much testing for pickle_ in picklers: - for protocol in -1, 0, 1, 2: + for protocol in range(-2, pickle.HIGHEST_PROTOCOL): yield pickle_.loads, lambda d: pickle_.dumps(d, protocol) |
