From ba4690e83d9543679053802690207182aa08a55e Mon Sep 17 00:00:00 2001 From: "Jay Freeman (saurik)" Date: Wed, 12 May 2010 12:51:33 +0000 Subject: [PATCH] Adjusted inspect.currentframe() to account for @contextmanager. --- __init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 -- 2.47.2