summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2016-10-17 00:22:38 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2016-10-17 12:13:01 -0400
commit8ef4f6a53864ce9c57c4879d6b2aa0f81ddbf596 (patch)
tree69575ef2f444ca2c9818956a6b0c561c0c55a6d0 /lib
parentc02675b407b8326643b559770d6d9686b880c113 (diff)
downloadsqlalchemy-8ef4f6a53864ce9c57c4879d6b2aa0f81ddbf596.tar.gz
Add explicit copy() to Enum
The Boolean and Enum types both place SchemaType second in the inheritance hierarchy. In the case of Enum, this works out that the copy() method is called from the base TypeEngine which fails to transfer _create_events. The test suite doesn't seem to work with the inhertance hierarchy set up like this as the event listeners don't work out, the _on_metadata_create and _on_table_create hooks cause the production of an adapted type which then adds event listeners that cause deque changed while iteration. It's not clear why Enum /Boolean don't have this problem. But in any case it seems like the class mechanics for these types remains fragile and would benefit from yet another refactor someday. Change-Id: Ib641a5d2321b00f58bbe98dd0c5e789374db32b2 Fixes: #3827
Diffstat (limited to 'lib')
-rw-r--r--lib/sqlalchemy/sql/sqltypes.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/sqlalchemy/sql/sqltypes.py b/lib/sqlalchemy/sql/sqltypes.py
index 78547ccf0..118c26070 100644
--- a/lib/sqlalchemy/sql/sqltypes.py
+++ b/lib/sqlalchemy/sql/sqltypes.py
@@ -1330,6 +1330,9 @@ class Enum(String, SchemaType):
)
assert e.table is table
+ def copy(self, **kw):
+ return SchemaType.copy(self, **kw)
+
def adapt(self, impltype, **kw):
schema = kw.pop('schema', self.schema)
metadata = kw.pop('metadata', self.metadata)