patch for igc: log -p crashed on unicode files
Alexander Belchenko
bialix at ukr.net
Fri Feb 27 12:18:55 GMT 2009
Alexander Belchenko пишет:
> Ian, here the patch for log -p problem.
> It has no test though, I've tested it manually.
> I hope it helps.
Here is another much simpler version. It tries to use
stream attribute from codecs-wrapped filestream.
I have not found any mention of stream attribute in the Python docs,
but I found it manually via dir():
In [15]: import codecs, sys
In [16]: f = codecs.getwriter('cp1251')(sys.stdout)
In [17]: f
Out[17]: <open file '<stdout>', mode 'w' at 0x008F0068>
In [18]: f is sys.stdout
Out[18]: False
In [19]: dir(f)
Out[19]:
['__doc__',
'__enter__',
'__exit__',
'__getattr__',
'__init__',
'__module__',
'decode',
'encode',
'errors',
'reset',
'stream',
'write',
'writelines']
In [20]: f.stream is sys.stdout
Out[20]: True
This patch is also w/o tests because writing proper test for this bug is not 5-minute work, sorry.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: log-p-unicode-2.diff
Url: https://lists.ubuntu.com/archives/bazaar/attachments/20090227/a6eaa665/attachment.diff
More information about the bazaar
mailing list