python-aspectlib icon indicating copy to clipboard operation
python-aspectlib copied to clipboard

Stack trace includes aspectlib itself

Open nedbat opened this issue 9 years ago • 1 comments

It's easy to skip the aspectlib frames:

diff --git a/src/aspectlib/debug.py b/src/aspectlib/debug.py
index 2ee6225..85d13b5 100644
--- a/src/aspectlib/debug.py
+++ b/src/aspectlib/debug.py
@@ -20,7 +20,8 @@ def frame_iterator(frame):
     Yields frames till there are no more.
     """
     while frame:
-        yield frame
+        if "aspectlib" not in frame.f_code.co_filename.split(os.path.sep):
+            yield frame
         frame = frame.f_back 

But the tests fail because the frames they are looking for are excluded by this. Not sure how to fix that, other than adding an aspectlib=True flag to debug.log for the tests to use.

nedbat avatar Nov 16 '15 12:11 nedbat

I think those are safe to remove from the tests. On the other hand, self-debugging is useful, a skip_aspectlib kwarg might be useful.

ionelmc avatar Nov 16 '15 12:11 ionelmc