diff options
Diffstat (limited to 'lib/sqlalchemy')
-rw-r--r-- | lib/sqlalchemy/sql/elements.py | 3 | ||||
-rw-r--r-- | lib/sqlalchemy/sql/selectable.py | 3 |
2 files changed, 4 insertions, 2 deletions
diff --git a/lib/sqlalchemy/sql/elements.py b/lib/sqlalchemy/sql/elements.py index fdb3fc8bb..346a84ddf 100644 --- a/lib/sqlalchemy/sql/elements.py +++ b/lib/sqlalchemy/sql/elements.py @@ -357,7 +357,8 @@ class ClauseElement( # process leaves around a lot of remnants of the previous clause # typically in the form of column expressions still attached to the # old table. - c._is_clone_of = self + cc = self._is_clone_of + c._is_clone_of = cc if cc is not None else self return c diff --git a/lib/sqlalchemy/sql/selectable.py b/lib/sqlalchemy/sql/selectable.py index 0692483e9..e143d1476 100644 --- a/lib/sqlalchemy/sql/selectable.py +++ b/lib/sqlalchemy/sql/selectable.py @@ -4135,7 +4135,8 @@ class _MemoizedSelectEntities( def _clone(self, **kw): c = self.__class__.__new__(self.__class__) c.__dict__ = {k: v for k, v in self.__dict__.items()} - c._is_clone_of = self + + c._is_clone_of = self.__dict__.get("_is_clone_of", self) return c @classmethod |