This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author doerwalter
Recipients doerwalter, vstinner
Date 2010-11-05.15:01:32
SpamBayes Score 1.7069679e-13
Marked as misclassified No
Message-id <1288969298.32.0.515004183172.issue10329@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2010-11-05 15:01:38doerwaltersetrecipients: + doerwalter, vstinner
2010-11-05 15:01:38doerwaltersetmessageid: <1288969298.32.0.515004183172.issue10329@psf.upfronthosting.co.za>
2010-11-05 15:01:34doerwalterlinkissue10329 messages
2010-11-05 15:01:33doerwaltercreate