| Summary: | python-native: the assert doesn't work | ||
|---|---|---|---|
| Product: | [Build System, Metadata & Runtime] OE-Core | Reporter: | Robert Yang <liezhi.yang> |
| Component: | devtools / tool chain | Assignee: | Robert Yang <liezhi.yang> |
| Status: | VERIFIED FIXED | QA Contact: | |
| Severity: | normal | ||
| Priority: | Medium | CC: | meta.mr.watcher, meta.watcher, ning.zhang, nitin.a.kamble, richard.purdie, sgw |
| Version: | 1.5 | ||
| Target Milestone: | 1.5 M1 | ||
| Hardware: | x86 | ||
| OS: | Multiple | ||
| Whiteboard: | |||
| OS type for building Yocto: | --- | Type of Regression: | --- |
| Verified: | Documentation change: | --- | |
|
Description
Robert Yang
2013-04-29 08:25:53 UTC
What issue are you trying to solve? (In reply to comment #1) > What issue are you trying to solve? Hi Saul, the 'assert' statement doesn't work which would cause/hide unexpected errors, and it is a widely used statement, e.g., the 'assert False' should raise an exception, but it doesn't since we have hard coded the default optimizaton to 1 (the assert would work when optimization is 0), usually, the python would work like this: Set the default optimizaton to 0 (and use -O/-OO to optimize when the user needs), we have set the default optimizaton to 1 by default ( we have disabled to -O/-OO, there is a "-N" option for the target python, but no such an option for the native python), my suggestions are: 1) We would not set the default optimization to 1, and don't disable the -O/-OO Or 2) If we want to set it, we should not change the source code to hard code it, we can "export PYTHONOPTIMIZE=1 or 2" in the env by default. Or 3) I think that we should do no optimization for the native python by default. Merged into master: http://git.yoctoproject.org/cgit/cgit.cgi/poky/commit/?id=2f7c588c5a8148eec37405186c34bdd1425ea30b Verified with poky(master:176a46b088135f2891983bb8540bc45389341d90) Native test log: wrsadmin@pek-nzhang0-d3:/home/yocto/20130527/tmp/sysroots/x86_64-linux/usr/bin/python-native$ python -N Unknown option: -N Unknown option: -N usage: python [option] ... [-c cmd | -m mod | file | -] [arg] ... Try `python -h' for more information. wrsadmin@pek-nzhang0-d3:/home/yocto/20130527/tmp/sysroots/x86_64-linux/usr/bin/python-native$ python -O Python 2.7.3 (default, Aug 1 2012, 05:14:39) [GCC 4.6.3] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> assert False >>> wrsadmin@pek-nzhang0-d3:/home/yocto/20130527/tmp/sysroots/x86_64-linux/usr/bin/python-native$ python Python 2.7.3 (default, Aug 1 2012, 05:14:39) [GCC 4.6.3] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> assert False Traceback (most recent call last): File "<stdin>", line 1, in <module> AssertionError Target python test result is same. |