Comment 9 for bug 686735

Revision history for this message
Alexander Belchenko (bialix) wrote : Re: bzr crashed with UnicodeDecodeError in run_subprocess_command()

@Marting[gz]: here is what I think should be the fix for this problem:

=== modified file 'lib/subprocess.py'
--- lib/subprocess.py 2010-10-21 11:32:48 +0000
+++ lib/subprocess.py 2011-04-14 12:55:40 +0000
@@ -890,9 +890,12 @@
         d = {}
         for key, val in e.__dict__.iteritems():
             if not key.startswith('_'):
- if not isinstance(val, unicode):
- val = unicode(val)
- d[key] = val
+ if isinstance(val, unicode):
+ d[key] = val
+ elif isinstance(val, str):

What do you think about it?

@Vasily: если можешь повторить проблему на своей машине, то пожалуйста протестируй мой патч.
+ d[key] = unicode(val, osutils.get_user_encoding(), 'replace')
+ else:
+ d[key] = repr(val)
         print "%s%s" % (SUB_ERROR,
                         bencode.bencode((e.__class__.__name__,
                                          encode_unicode_escape(d))))