Bug 614 - LSB: Change of default encoding of python cause python-runtime test failure(test_builtin.py, test_getargs.py)
Summary: LSB: Change of default encoding of python cause python-runtime test failure(t...
Status: RESOLVED FIXED
Alias: None
Product: OE-Core
Classification: Build System, Metadata & Runtime
Component: devtools / tool chain (show other bugs)
Version: 1.0
Hardware: x86 x86
: Medium normal
Target Milestone: 1.0 M4
Assignee: Jingdong Lu
QA Contact:
URL:
Whiteboard:
Depends on:
Blocks:
 
Reported: 2010-12-23 00:50 UTC by Jingdong Lu
Modified: 2011-02-16 00:58 UTC (History)
8 users (show)

See Also:
OS type for building Yocto: ---
Type of Regression: ---
Verified:
Documentation change: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jingdong Lu 2010-12-23 00:50:16 UTC
A part of python-runtime test report
...
<09:28:08> test_builtin
<09:28:11> test test_builtin failed -- errors occurred; run in verbose mode for details
...
<09:34:58> test test_getargs crashed -- <type 'exceptions.ValueError'>: bad marshal data

Using command line to try to get more information:
eg. test_getargs.py
Failure result is like this,
>>> import marshal
>>> marshal.loads(u'\x92')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: bad marshal data
>>>

Correct result should be:
>>> import marshal
>>> marshal.loads(u'\x92')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
UnicodeEncodeError: 'ascii' codec can't encode character u'\x92' in position 0: ordinal not in range(128)
>>> 

I recompiled python without -O2/-O3 option and debug it using gdb. I found that the default encoding has been changed at beginning.
site.py
|-- execsitecustomize() 
    |-- import sitecustomize
sitecustomize.py
|-- sys.setdefaultencoding( "utf8" )

So, because of setting default encoding from "ascii" to "utf8" and LSB require the default encoding is "ascii", the test failed. I delete "sitecustomize.py" or make relevant lines and we can get the above two tests passed.

I find this file "sitecustomize.py" in OE recipe and I wonder whether it is possible to delete it.

Any suggestion?
Comment 1 Jingdong Lu 2011-02-16 00:58:42 UTC
Remove sitecustomize.py for lsb image.