This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author terry.reedy
Recipients georg.brandl, jonaskoelker, terry.reedy, vstinner
Date 2010-03-22.16:57:22
SpamBayes Score 2.5397462e-12
Marked as misclassified No
Message-id <1269277045.17.0.743405625582.issue1069092@psf.upfronthosting.co.za>
In-reply-to
Content
General policy is that ordinary code (not using, for instance, ctypes) should not crash or segfault the interpreter.  I believe there is a 'crashers' subdirectory somewhere in the tree for examples that do so that people so inclined can work on them.

The OP reported a crash on 2.3/2.4a on Linux, but not 1.5. I could not reproduce it on 2.2 on Windows. Instead, I (properly) got an exception. Trying again with 3.1, I get a similar exception: RuntimeError: maximum recursion depth exceeded while getting the repr of a tuple. List instead of tuple does similar.

If 
>>> t=None,
>>> for i in range(50000): t = t,None

>>> print(t)

still crashes on 2.6/2.7, at least with Linux, then there is still a bug to be fixed and the issue should be left open. If it now raises an exception as above, then this should be closed as fixed.

I am pretty sure this issue has nothing to do with None and Ellipsis but only with the structure (not necessarily a sequence) being deeply, deeply nested. So I think the title should be: "Segfault on printing deeply nested structures."

I think the deeper issue is the use of recursion on the C stack to print. If the print routine instead usee iteration with an auxiliary Python stack (list), then there should be no stack overflow to worry about. [When in increase the recursion limit to 100000 and try to print the 50000 nested tuples, I get "MemoryError: stack overflow" instead of the RuntimeError above. So there might be more than one fix needed.]
History
Date User Action Args
2010-03-22 16:57:25terry.reedysetrecipients: + terry.reedy, georg.brandl, vstinner, jonaskoelker
2010-03-22 16:57:25terry.reedysetmessageid: <1269277045.17.0.743405625582.issue1069092@psf.upfronthosting.co.za>
2010-03-22 16:57:23terry.reedylinkissue1069092 messages
2010-03-22 16:57:22terry.reedycreate