diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2013-08-02 13:27:30 -0400 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2013-08-02 13:27:30 -0400 |
commit | 58b4b8890786b4684fdff217b2ce7fd89b0bf113 (patch) | |
tree | a27e7d437a589673c8dfe51084dd97eb7ab3fcd6 | |
parent | 31ec1fc85eda517c2bc70fd4c9bbd4d51a2546a6 (diff) | |
download | sqlalchemy-58b4b8890786b4684fdff217b2ce7fd89b0bf113.tar.gz |
a missing cursor.close() here caused a *huge* amount of weird locking issues with pypy,
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.
-rw-r--r-- | lib/sqlalchemy/engine/default.py | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/lib/sqlalchemy/engine/default.py b/lib/sqlalchemy/engine/default.py index b8c3768a8..7b5a22251 100644 --- a/lib/sqlalchemy/engine/default.py +++ b/lib/sqlalchemy/engine/default.py @@ -263,14 +263,17 @@ class DefaultDialect(interfaces.Dialect): 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 |