Different byte-code in same major version (2.6.x)?

Thomas Jollans thomas at jollans.com
Tue Jun 15 10:14:24 EDT 2010


On 06/15/2010 02:54 PM, Hartmut Goebel wrote:
> Hi,
> 
> I'm facing a curious problem: 2.6, 2.6.1 and 2.6.4 are generating
> different byte-code for the same source. I can not find the reason for.
> 
> As you may know, I'm providing the 'decompyle' service as
> www.crazy-comnpilers.com. This service includes verification of the
> source against the original byte code. So I need to solve these kind of
> differences.

Do you know for certain that these builds were all compiled from the
vanilla python.org source? If the builds were created by different
distributors, patches might have been added, and these patches might
affect the byte-code generated.

> This is the source:
> 
>    e.args += ('xxx',)
> 
> While Python 2.6 (r26:66714, Oct 24 2008, 17:31:07) and Python 2.6.4
> (r264:75706, Jan  8 2010, 18:50:31) both optimize the source and load a
> tuple constant,
> 
>   LOAD_NAME         'e'
>   DUP_TOP
>   LOAD_ATTR         'args'
>   # load a tuple constant
>   LOAD_CONST        ('xxx',)
>   INPLACE_ADD
>   ROT_TWO
>   STORE_ATTR        'args'
> 
> Python 2.6.1 (r261:67515, Jul  7 2009, 23:51:51)
> [GCC 4.2.1 (Apple Inc. build 5646)] on darwin
> does *not* optimize:
> 
>   LOAD_NAME         'e'
>   DUP_TOP
>   LOAD_ATTR         'args'
>   # load a string an build a tuple
>   LOAD_CONST        'xxx'
>   BUILD_TUPLE_1
>   INPLACE_ADD
>   ROT_TWO
>   STORE_ATTR        'args'
> 
> I checked the source in SVN and did not find any change here. But why
> does this 2.6.1 generate different byte-code then? Is there anything
> special about the Darwin-Build?
> 




More information about the Python-list mailing list