Terry J. Reedy <tjre...@udel.edu> added the comment:

Running the exact same binary on winxp with an amd athlon processor,
I *did* get a crash after about 5 seconds. "python.exe has encountered a 
problem and needs to close.  We are sorry for the inconvenience."
Trying again with IDLE instead of the command window, I get the same message 
(for pythonw instead of python) and the shell restarts when I close the message.

Even though foo()+[1] correctly raises a TypeError, the reverse [1] + foo() 
very bizarrely produces a length 1 tuple whose bizarre member is supposedly an 
instance of a empty list [] with length 1

from collections import namedtuple
foo = namedtuple('foo', '')
a = [1] + foo()
b=a[0]
print (type(a), len(a), type(b), len(type(b)), type(type(b)))

# <class 'tuple'> 1 [] 1 <class 'list'>

([2]+foo() produces same output)

Other than the above, any attempt to do anything with b or type(b) that I tried 
crashes. I presume that this is due to attribute lookups on the invalid type(b) 
(or something like that), which type(b) must bypass. In particular, the OP's 
crash is due to trying to print the tuple which tries to print its member which 
looks for type(b).__str__ which crashes.

To anyone: investigating crashers like this is a lot easier with IDLE and an 
edit window than with the interactive command window.

----------
nosy: +tjreedy
resolution: works for me -> 

_______________________________________
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