Protected against testing "None" as a class in the case where
declarative classes are being garbage collected and new
automap prepare() operations are taking place concurrently, very
infrequently hitting a weakref that has not been fully acted upon
after gc.
Change-Id: I32e1dfc5ac46bac4127fe808cfd18368e2fad9dd
.. changelog::
:version: 1.1.10
+ .. change:: 3980
+ :tags: bug, ext
+ :versions: 1.2.0b1
+ :tickets: 3980
+
+ Protected against testing "None" as a class in the case where
+ declarative classes are being garbage collected and new
+ automap prepare() operations are taking place concurrently, very
+ infrequently hitting a weakref that has not been fully acted upon
+ after gc.
+
.. change:: 3966
:tags: bug, mysql
:versions: 1.2.0b1
name_for_collection_relationship,
generate_relationship):
local_table = map_config.local_table
- local_cls = map_config.cls
+ local_cls = map_config.cls # derived from a weakref, may be None
- if local_table is None:
+ if local_table is None or local_cls is None:
return
for constraint in local_table.constraints:
if isinstance(constraint, ForeignKeyConstraint):
@classmethod
def classes_for_base(cls, base_cls, sort=True):
- classes_for_base = [m for m in cls._configs.values()
- if issubclass(m.cls, base_cls)]
+ classes_for_base = [
+ m for m, cls_ in
+ [(m, m.cls) for m in cls._configs.values()]
+ if cls_ is not None and issubclass(cls_, base_cls)
+ ]
+
if not sort:
return classes_for_base