[issue8847] crash appending list and namedtuple

Jack Diederich report at bugs.python.org
Sat Jun 5 03:31:57 CEST 2010


Jack Diederich <jackdied at gmail.com> added the comment:

if the id() of the left operand is identical to the id() of the first element in the result it would strongly support compiler skulldugerry.

class Crasher(tuple): pass
foo = Crasher()
x = [1]
a = x + foo
b=a[0]

if id(b) == id(x):
  raise Exception("It's the C compiler what did it!")

The only way I can think of this coming about is the right_op getting new'd and then .extend'ing(left_op).  That extend() must be going batsh*t and inserting the left_op instead of it's contained items.  The C-code for extend is more fiddly than the code for concatenation so there is more room for the compiler to generate bad code.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue8847>
_______________________________________


More information about the Python-bugs-list mailing list