From: Jay Freeman (saurik) <saurik@saurik.com>
Date: Wed, 12 May 2010 12:51:33 +0000 (+0000)
Subject: Adjusted inspect.currentframe() to account for @contextmanager.
X-Git-Url: https://git.saurik.com/cyql.git/commitdiff_plain/ba4690e83d9543679053802690207182aa08a55e

Adjusted inspect.currentframe() to account for @contextmanager.
---

diff --git a/__init__.py b/__init__.py
index 6eafaee..00a4573 100644
--- a/__init__.py
+++ b/__init__.py
@@ -27,7 +27,8 @@ class connection(object):
     @contextmanager
     def execute(self, statement, depth=0):
         with self.cursor() as cursor:
-            locals = inspect.currentframe(depth + 1).f_locals
+            # two frames, accounting for execute() and @contextmanager
+            locals = inspect.currentframe(depth + 2).f_locals
             cursor.execute(statement.format(**locals), locals)
             yield cursor