[Twisted-Python] Failure.getTraceback and Unicode
Hi, The code for "getTraceback" http://twistedmatrix.com/trac/browser/tags/releases/twisted-13.1.0/twisted/p... uses a native version of StringIO http://twistedmatrix.com/trac/browser/tags/releases/twisted-13.1.0/twisted/p... However, cStringIO: "Unlike the StringIOhttp://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
On 04:24 pm, tobias.oberstein@tavendo.de wrote:
Hi,
The code for "getTraceback"
http://twistedmatrix.com/trac/browser/tags/releases/twisted-13.1.0/twisted/p...
uses a native version of StringIO
http://twistedmatrix.com/trac/browser/tags/releases/twisted-13.1.0/twisted/p...
However, cStringIO:
`NativeStringIO` doesn't mean `cStringIO`. On Python 2, it means `io.BytesIO` - which, as you observed, does not support unicode. :)
Should I file a bug?
It seems unfortunate that trying to report an exception will fail because of encoding issues. That seems like a bug worth fixing to me. Jean-Paul
Hi Jean-Paul,
Should I file a bug?
It seems unfortunate that trying to report an exception will fail because of encoding issues. That seems like a bug worth fixing to me.
Alright. https://twistedmatrix.com/trac/ticket/6708 /Tobias
Jean-Paul
_______________________________________________ Twisted-Python mailing list Twisted-Python@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
participants (2)
-
exarkun@twistedmatrix.com
-
Tobias Oberstein