New submission from Walter Dörwald <wal...@livinglogic.de>:

It seems that on Python 3 (i.e. the py3k branch) trace.py can not handle source 
that includes Unicode characters. Running the test suite with code coverage 
info via

   ./python Lib/test/regrtest.py -T -N -uurlfetch,largefile,network,decimal

sometimes fails with the following exception:

Traceback (most recent call last):
  File "Lib/test/regrtest.py", line 1500, in <module>
    main()
  File "Lib/test/regrtest.py", line 696, in main
    r.write_results(show_missing=True, summary=True, coverdir=coverdir)
  File "/home/coverage/python/Lib/trace.py", line 319, in write_results
    lnotab, count)
  File "/home/coverage/python/Lib/trace.py", line 369, in write_results_file
    outfile.write(line.expandtabs(8))
UnicodeEncodeError: 'ascii' codec can't encode character '\xe4' in
position 30: ordinal not in range(128)

The script that produces code coverage info on http://coverage.livinglogic.de/ 
uses this feature to generate code coverage info.

Applying the attached patch (i.e. specifying an explicit encoding when opening 
the output file) fixes the problem.

----------
files: trace.diff
keywords: patch
messages: 120506
nosy: doerwalter, haypo
priority: normal
severity: normal
status: open
title: trace.py and unicode in Python 3
Added file: http://bugs.python.org/file19505/trace.diff

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue10329>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to