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

Hartmut Goebel h.goebel at crazy-compilers.com
Tue Jun 15 08:54:42 EDT 2010


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.

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?

-- 
Regards
Hartmut Goebel

| Hartmut Goebel          | h.goebel at crazy-compilers.com               |
| www.crazy-compilers.com | compilers which you thought are impossible |



More information about the Python-list mailing list