STINNER Victor added the comment: > You're supposed to use that code to create a file (the output file is just > ""+""+""+""+""+""+""+""+""+...+"").
Oh ok, the bug is in Python compiler. It's probably an overflow of the C stack. The bug was fixed in Python 3.3 by the issue #5765: see changeset ab02cd145f56. See also the issue #19098 ("sys.setrecursionlimit(2**30) breaks interactive shell") and the changeset c3df31cbcd0a. Nick Coghlan wrote in the issue #5765: "However, agreed on the won't fix for 3.2 and 2.7, although I'd consider it at least for 2.7 if someone went through and worked out a patch that applies cleanly." $ python2 Python 2.7.5 (default, Sep 25 2014, 13:57:38) [GCC 4.8.3 20140911 (Red Hat 4.8.3-7)] on linux2>>> compile('1' + '+1'*10**5, '<string>', 'exec') <code object <module> at 0x7f8c5ba2c1b0, file "<string>", line 1> >>> compile('1' + '+1'*10**6, '<string>', 'exec') Erreur de segmentation (core dumped) $ python3 Python 3.3.2 (default, Jun 30 2014, 17:20:03) [GCC 4.8.3 20140624 (Red Hat 4.8.3-1)] on linux >>> compile('1' + '+1'*10**3, '<string>', 'exec') <code object <module> at 0x7f7298d479c0, file "<string>", line 1> >>> compile('1' + '+1'*10**4, '<string>', 'exec') Traceback (most recent call last): File "<stdin>", line 1, in <module> RuntimeError: maximum recursion depth exceeded during compilation ---------- nosy: +ncoghlan title: Segmentation fault with string concatenation -> C stack overflow in the Python 2.7 compiler _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue22583> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com