From d3e0b8e750d864766148cdf1a658a601079eed46 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Wed, 31 Aug 2022 11:07:23 -0400 Subject: run update_subclass anytime we add new clslevel dispatch Fixed event listening issue where event listeners added to a superclass would be lost if a subclass were created which then had its own listeners associated. The practical example is that of the :class:`.sessionmaker` class created after events have been associated with the :class:`_orm.Session` class. Fixes: #8467 Change-Id: I9bdba8769147e30110a09900d4a577e833ac3af9 --- lib/sqlalchemy/sql/annotation.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'lib/sqlalchemy/sql') diff --git a/lib/sqlalchemy/sql/annotation.py b/lib/sqlalchemy/sql/annotation.py index 95dc1d4d4..86b2952cb 100644 --- a/lib/sqlalchemy/sql/annotation.py +++ b/lib/sqlalchemy/sql/annotation.py @@ -559,7 +559,8 @@ def _new_annotation_type( def _prepare_annotations( - target_hierarchy: Type[SupportsAnnotations], base_cls: Type[Annotated] + target_hierarchy: Type[SupportsWrappingAnnotations], + base_cls: Type[Annotated], ) -> None: for cls in util.walk_subclasses(target_hierarchy): _new_annotation_type(cls, base_cls) -- cgit v1.2.1