Antoine Pitrou added the comment:

The exact same issue happens when concatenating a list subclass to a tuple:

>>> () + L([1,2])
[1, 2]
>>> (3,) + L([1,2])
# crash

Also, note that in this case a list is returned, not a tuple despite the first 
operand being a tuple. Conversely:

>>> [] + T((1,2))
(1, 2)

A tuple is returned, not a list. Which is exactly what happens when calling 
T.__add__:

>>> T.__add__((), T((1,2)))
(1, 2)

My intuition is that the issue is somewhere in binary_op1() (called by 
PyNumber_Add) in abstract.c. I can't go much further since my own builds don't 
exhibit the issue.

(in the end, chances are it's a MSVC compiler bug)

----------
nosy: +amaury.forgeotdarc

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue8847>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to