[Twisted-Python] Failure.getTraceback and Unicode

Tobias Oberstein tobias.oberstein at tavendo.de
Mon Aug 26 10:24:16 MDT 2013


Hi,

The code for "getTraceback"

http://twistedmatrix.com/trac/browser/tags/releases/twisted-13.1.0/twisted/python/failure.py#L529

uses a native version of StringIO

http://twistedmatrix.com/trac/browser/tags/releases/twisted-13.1.0/twisted/python/failure.py#L23

However, cStringIO:

"Unlike the StringIO<http://docs.python.org/2/library/stringio.html#module-StringIO> module, this module is not able to accept Unicode strings that cannot be encoded as plain ASCII strings."
http://docs.python.org/2/library/stringio.html#module-cStringIO

Above situation triggers an exception when the traceback includes non-ASCII Unicode strings:

"""
'unicode' does not have the buffer interface
"""

I have worked around this by implementing my own "getTraceback" that uses standard (non-native) StringIO. Works.

Should I file a bug?

/Tobias
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://twistedmatrix.com/pipermail/twisted-python/attachments/20130826/f5ac6cdd/attachment.html>


More information about the Twisted-Python mailing list