From 5bfe1467f7611da791856da7231c86e2e76f598c Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Fri, 16 Apr 2010 13:28:05 +0000 Subject: [PATCH] Issue #7606: XML-RPC traceback stored in X-traceback is now encoded to ASCII using backslashreplace error handler. --- Lib/xmlrpc/server.py | 4 +++- Misc/NEWS | 3 +++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Lib/xmlrpc/server.py b/Lib/xmlrpc/server.py index 63df97fbce8..eb231d3db49 100644 --- a/Lib/xmlrpc/server.py +++ b/Lib/xmlrpc/server.py @@ -499,7 +499,9 @@ def do_POST(self): if hasattr(self.server, '_send_traceback_header') and \ self.server._send_traceback_header: self.send_header("X-exception", str(e)) - self.send_header("X-traceback", traceback.format_exc()) + trace = traceback.format_exc() + trace = str(trace.encode('ASCII', 'backslashreplace'), 'ASCII') + self.send_header("X-traceback", trace) self.send_header("Content-length", "0") self.end_headers() diff --git a/Misc/NEWS b/Misc/NEWS index c583fa372f2..81683c98c59 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -312,6 +312,9 @@ C-API Library ------- +- Issue #7606: XML-RPC traceback stored in X-traceback is now encoded to ASCII + using backslashreplace error handler + - Issue #8412: os.system() now accepts bytes, bytearray and str with surrogates.