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

Commit 03559bb

Browse files
authored
fix: Fix stacktraces in some situations being the wong way round (#1261)
1 parent 96d9c81 commit 03559bb

File tree

4 files changed

+8
-3
lines changed

4 files changed

+8
-3
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ Changelog
44
All notable changes to this project will be documented in this file.
55
Project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
66

7+
6.10.0
8+
------
9+
10+
* [Core] Fixed stackframes in some situations being in inverse order.
11+
712
6.9.0 (2018-05-30)
813
------------------
914
* [Core] Switched from culprit to transaction for automatic transaction reporting.

raven/utils/stacks.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ def iter_stack_frames(frames=None):
134134
if not frames:
135135
frames = inspect.stack()[1:]
136136

137-
for frame, lineno in ((f[0], f[2]) for f in frames):
137+
for frame, lineno in ((f[0], f[2]) for f in reversed(frames)):
138138
f_locals = getattr(frame, 'f_locals', {})
139139
if not _getitem_from_frame(f_locals, '__traceback_hide__'):
140140
yield frame, lineno

tests/base/tests.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -491,7 +491,7 @@ def bar():
491491
self.assertEquals(event['message'], 'test')
492492
assert 'stacktrace' in event
493493
self.assertEquals(len(frames), len(event['stacktrace']['frames']))
494-
for frame, frame_i in zip(frames, event['stacktrace']['frames']):
494+
for frame, frame_i in zip(frames[::-1], event['stacktrace']['frames']):
495495
self.assertEquals(frame[0].f_code.co_filename, frame_i['abs_path'])
496496
self.assertEquals(frame[0].f_code.co_name, frame_i['function'])
497497

tests/handlers/logging/tests.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ def test_record_stack(self):
171171
self.assertTrue('stacktrace' in event)
172172
frames = event['stacktrace']['frames']
173173
self.assertNotEquals(len(frames), 1)
174-
frame = frames[0]
174+
frame = frames[-1]
175175
self.assertEqual(frame['module'], 'raven.handlers.logging')
176176
assert 'exception' not in event
177177
self.assertTrue('sentry.interfaces.Message' in event)

0 commit comments

Comments
 (0)