From 5a28c9d8cd105d5c42b927850bb3652e9b24d379 Mon Sep 17 00:00:00 2001 From: Pietro Berkes Date: Tue, 6 Jul 2010 21:24:33 -0400 Subject: [PATCH] in persistent_locals2, the f_locals dictionary is copied now --- deco.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/deco.py b/deco.py index 21283a6..c02e5f9 100644 --- a/deco.py +++ b/deco.py @@ -111,17 +111,17 @@ class persistent_locals2(object): This decorator does not play nice with profilers, and will cause them to not be able to assign execution time to functions. """ - + def __init__(self, func): self._locals = {} self.func = func - + def __call__(self, *args, **kwargs): - + def tracer(frame, event, arg): if event=='return': - self._locals = frame.f_locals - + self._locals = frame.f_locals.copy() + # tracer is activated on next call, return or exception sys.setprofile(tracer) try: