what is strange is how it only occurred in some very specific places under very
particular conditions, perhaps it has to do with whether or not this cursor gets
gc'ed or not.
cast_to = util.text_type
cursor = connection.connection.cursor()
- cursor.execute(
- cast_to(
- expression.select([
- expression.literal_column("'x'").label("some_label")
- ]).compile(dialect=self)
+ try:
+ cursor.execute(
+ cast_to(
+ expression.select([
+ expression.literal_column("'x'").label("some_label")
+ ]).compile(dialect=self)
+ )
)
- )
- return isinstance(cursor.description[0][0], util.text_type)
+ return isinstance(cursor.description[0][0], util.text_type)
+ finally:
+ cursor.close()
def type_descriptor(self, typeobj):
"""Provide a database-specific :class:`.TypeEngine` object, given