<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugzilla.yoctoproject.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugzilla.yoctoproject.org/"
          
          maintainer="it-coreprojects-helpdesk@linuxfoundation.org"
>

    <bug>
          <bug_id>4427</bug_id>
          
          <creation_ts>2013-04-29 08:25:53 +0000</creation_ts>
          <short_desc>python-native: the assert doesn&apos;t work</short_desc>
          <delta_ts>2013-05-28 09:33:19 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>7</classification_id>
          <classification>Build System, Metadata &amp; Runtime</classification>
          <product>OE-Core</product>
          <component>devtools / tool chain</component>
          <version>1.5</version>
          <rep_platform>x86</rep_platform>
          <op_sys>Multiple</op_sys>
          <bug_status>VERIFIED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>Medium</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>1.5 M1</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Robert Yang">liezhi.yang</reporter>
          <assigned_to name="Robert Yang">liezhi.yang</assigned_to>
          <cc>meta.mr.watcher</cc>
    
    <cc>meta.watcher</cc>
    
    <cc>ning.zhang</cc>
    
    <cc>nitin.a.kamble</cc>
    
    <cc>richard.purdie</cc>
    
    <cc>sgw</cc>
          
          
          <cf_os>---</cf_os>
          <cf_regression_type>---</cf_regression_type>
          
          <cf_docchange>---</cf_docchange>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>32705</commentid>
    <comment_count>0</comment_count>
    <who name="Robert Yang">liezhi.yang</who>
    <bug_when>2013-04-29 08:25:53 +0000</bug_when>
    <thetext>We had set the deafult optimization to 1 by the patch 04-default-is-optimized.patch, the assert doesn&apos;t work when optimization is 1, both native and target have this patch, but they are different, the target&apos;s optimization can be disabled by the &quot;-N&quot; option, the native python doesn&apos;t have the &quot;-N&quot; option. I think that we have two solutions:

1) Add the &quot;-N&quot; option for the native python

or

2) We won&apos;t set the optimization by default just like other distributions do, the user can set it by the &quot;-O&quot; option, we have removed the &quot;-O&quot; and &quot;-OO&quot; option currently.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>32733</commentid>
    <comment_count>1</comment_count>
    <who name="Saul Wold">sgw</who>
    <bug_when>2013-04-29 18:31:36 +0000</bug_when>
    <thetext>What issue are you trying to solve?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>32743</commentid>
    <comment_count>2</comment_count>
    <who name="Robert Yang">liezhi.yang</who>
    <bug_when>2013-04-30 01:43:38 +0000</bug_when>
    <thetext>(In reply to comment #1)
&gt; What issue are you trying to solve?

Hi Saul, the &apos;assert&apos; statement doesn&apos;t work which would cause/hide unexpected errors, and it is a widely used statement, e.g., the &apos;assert False&apos; should raise an exception, but it doesn&apos;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 &quot;-N&quot; 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&apos;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 &quot;export PYTHONOPTIMIZE=1 or 2&quot; in the env by default.

Or

3) I think that we should do no optimization for the native python by default.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>33053</commentid>
    <comment_count>3</comment_count>
    <who name="Robert Yang">liezhi.yang</who>
    <bug_when>2013-05-11 04:59:11 +0000</bug_when>
    <thetext>Merged into master:
http://git.yoctoproject.org/cgit/cgit.cgi/poky/commit/?id=2f7c588c5a8148eec37405186c34bdd1425ea30b</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>33325</commentid>
    <comment_count>4</comment_count>
    <who name="Ning Zhang">ning.zhang</who>
    <bug_when>2013-05-28 09:33:19 +0000</bug_when>
    <thetext>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&apos; 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 &quot;help&quot;, &quot;copyright&quot;, &quot;credits&quot; or &quot;license&quot; for more information.
&gt;&gt;&gt; assert False
&gt;&gt;&gt; 

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 &quot;help&quot;, &quot;copyright&quot;, &quot;credits&quot; or &quot;license&quot; for more information.
&gt;&gt;&gt; assert False
Traceback (most recent call last):
  File &quot;&lt;stdin&gt;&quot;, line 1, in &lt;module&gt;
AssertionError

Target python test result is same.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>