--- /dev/null
+.. change::
+ :tags: bug, orm
+ :tickets: 11365
+
+ Fixed issue where a :class:`.MetaData` collection would not be
+ serializable, if an :class:`.Enum` or :class:`.Boolean` datatype were
+ present which had been adapted. This specific scenario in turn could occur
+ when using the :class:`.Enum` or :class:`.Boolean` within ORM Annotated
+ Declarative form where type objects frequently get copied.
{"__slots__": self._event_names},
)
self.__class__._joined_dispatch_cls = cls
+
+ # establish pickle capability by adding it to this module
+ globals()[cls.__name__] = cls
+
return self._joined_dispatch_cls(self, other)
def __reduce__(self) -> Union[str, Tuple[Any, ...]]:
self.parent = parent
self._instance_cls = self.local._instance_cls
+ def __reduce__(self) -> Any:
+ return (self.__class__, (self.local, self.parent))
+
def __getattr__(self, name: str) -> _JoinedListener[_ET]:
# Assign _JoinedListeners as attributes on demand
# to reduce startup time for new dispatch objects.
("Big", BigInteger()),
("Num", Numeric()),
("Flo", Float()),
+ ("Enu", Enum("one", "two", "three")),
("Dat", DateTime()),
("Dat", Date()),
("Tim", Time()),
("Lar", LargeBinary()),
("Pic", PickleType()),
("Int", Interval()),
+ argnames="name,type_",
id_="ar",
)
- def test_pickle_types(self, name, type_):
+ @testing.variation("use_adapt", [True, False])
+ def test_pickle_types(self, name, type_, use_adapt):
+
+ if use_adapt:
+ type_ = type_.copy()
+
column_type = Column(name, type_)
meta = MetaData()
Table("foo", meta, column_type)