Skip to content
This repository has been archived by the owner on Oct 23, 2023. It is now read-only.

Commit

Permalink
fix: Fix stacktraces in some situations being the wong way round (#1261)
Browse files Browse the repository at this point in the history
  • Loading branch information
mitsuhiko authored Jun 14, 2018
1 parent 96d9c81 commit 03559bb
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 3 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ Changelog
All notable changes to this project will be documented in this file.
Project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

6.10.0
------

* [Core] Fixed stackframes in some situations being in inverse order.

6.9.0 (2018-05-30)
------------------
* [Core] Switched from culprit to transaction for automatic transaction reporting.
Expand Down
2 changes: 1 addition & 1 deletion raven/utils/stacks.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ def iter_stack_frames(frames=None):
if not frames:
frames = inspect.stack()[1:]

for frame, lineno in ((f[0], f[2]) for f in frames):
for frame, lineno in ((f[0], f[2]) for f in reversed(frames)):
f_locals = getattr(frame, 'f_locals', {})
if not _getitem_from_frame(f_locals, '__traceback_hide__'):
yield frame, lineno
Expand Down
2 changes: 1 addition & 1 deletion tests/base/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,7 @@ def bar():
self.assertEquals(event['message'], 'test')
assert 'stacktrace' in event
self.assertEquals(len(frames), len(event['stacktrace']['frames']))
for frame, frame_i in zip(frames, event['stacktrace']['frames']):
for frame, frame_i in zip(frames[::-1], event['stacktrace']['frames']):
self.assertEquals(frame[0].f_code.co_filename, frame_i['abs_path'])
self.assertEquals(frame[0].f_code.co_name, frame_i['function'])

Expand Down
2 changes: 1 addition & 1 deletion tests/handlers/logging/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ def test_record_stack(self):
self.assertTrue('stacktrace' in event)
frames = event['stacktrace']['frames']
self.assertNotEquals(len(frames), 1)
frame = frames[0]
frame = frames[-1]
self.assertEqual(frame['module'], 'raven.handlers.logging')
assert 'exception' not in event
self.assertTrue('sentry.interfaces.Message' in event)
Expand Down

0 comments on commit 03559bb

Please sign in to comment.