Merge ~cjwatson/launchpad:py3-stacktrace into launchpad:master

Proposed by Colin Watson
Status: Merged
Approved by: Colin Watson
Approved revision: b9532cd8f50dfc101760e96509dda159baf95451
Merge reported by: Otto Co-Pilot
Merged at revision: not available
Proposed branch: ~cjwatson/launchpad:py3-stacktrace
Merge into: launchpad:master
Diff against target: 31 lines (+3/-3)
1 file modified
lib/lp/services/stacktrace.py (+3/-3)
Reviewer Review Type Date Requested Status
Colin Watson (community) Approve
Cristian Gonzalez (community) Approve
Review via email: mp+396330@code.launchpad.net

Commit message

Fix lp.services.stacktrace tests for Python 3

Description of the change

DEBUG_EXCEPTION_FORMATTER needs to write to sys.stderr rather than sys.stdout. This is what the tests expect, and it makes more sense anyway.

To post a comment you must log in.
Revision history for this message
Cristian Gonzalez (cristiangsp) wrote :

Looks good!

review: Approve
Revision history for this message
Colin Watson (cjwatson) :
review: Approve
Revision history for this message
Colin Watson (cjwatson) wrote :

(Oops, meant to top-approve. I'm Colin Watson and I approve this message, or something.)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/lib/lp/services/stacktrace.py b/lib/lp/services/stacktrace.py
2index 39105bc..6b3cacb 100644
3--- a/lib/lp/services/stacktrace.py
4+++ b/lib/lp/services/stacktrace.py
5@@ -31,7 +31,7 @@ def _try_except(callable, *args, **kwargs):
6 raise
7 except:
8 if DEBUG_EXCEPTION_FORMATTER:
9- traceback.print_exc()
10+ traceback.print_exc(file=sys.stderr)
11 # return None
12
13
14@@ -104,7 +104,7 @@ def format_list(extracted_list):
15 # The values above may not stringify properly, or who knows what
16 # else. Be defensive.
17 if DEBUG_EXCEPTION_FORMATTER:
18- traceback.print_exc()
19+ traceback.print_exc(file=sys.stderr)
20 # else just swallow the exception.
21 item.append('') # This gives us a trailing newline.
22 list.append('\n'.join(item))
23@@ -172,7 +172,7 @@ def _get_frame_data(f, lineno):
24 raise
25 except:
26 if DEBUG_EXCEPTION_FORMATTER:
27- traceback.print_exc()
28+ traceback.print_exc(file=sys.stderr)
29 supplement_dict = dict(warnings=warnings, extra=extra)
30 for key in ('source_url', 'line', 'column', 'expression'):
31 value = getattr(supplement, key, None)

Subscribers

People subscribed via source and target branches

to status/vote changes: