[issue16527] (very) long list of elif causes segfault

2012-11-22 Thread Marc-Andre Lemburg
Marc-Andre Lemburg added the comment: On 22.11.2012 00:41, Alexis Daboville wrote: A possible cause (if I understood http://greentreesnakes.readthedocs.org/en/latest/nodes.html#If well) is that there are no elif nodes in the AST, elif are just plain ifs which are stored recursively in

[issue16527] (very) long list of elif causes segfault

2012-11-22 Thread Alexis Daboville
Alexis Daboville added the comment: I don't think it can be fixed with sys.setrecursionlimit for a few reasons: * I think the issue arises when the AST is built. Otherwise if we put code before the if it would execute. But that's not the case (try putting a print('hello') before the if and it

[issue16527] (very) long list of elif causes segfault

2012-11-22 Thread Marc-Andre Lemburg
Marc-Andre Lemburg added the comment: On 22.11.2012 10:26, Alexis Daboville wrote: Alexis Daboville added the comment: I don't think it can be fixed with sys.setrecursionlimit for a few reasons: I think you misunderstood. The suggestion was to use the sys function to check whether the

[issue16527] (very) long list of elif causes segfault

2012-11-22 Thread Mark Dickinson
Mark Dickinson added the comment: I think the issue arises when the AST is built. It's occurring when generating a code object from the AST, after the AST is built: Python 3.3.0+ (3.3:bf1bf3bf3fe2, Nov 22 2012, 10:45:24) [GCC 4.2.1 (Apple Inc. build 5664)] on darwin Type help, copyright,

[issue16527] (very) long list of elif causes segfault

2012-11-22 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: This may be a duplicate of issue5765. -- nosy: +serhiy.storchaka resolution: - duplicate superseder: - stack overflow evaluating eval(() * 3) ___ Python tracker rep...@bugs.python.org

[issue16527] (very) long list of elif causes segfault

2012-11-22 Thread Brett Cannon
Changes by Brett Cannon br...@python.org: -- nosy: +brett.cannon ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16527 ___ ___ Python-bugs-list

[issue16527] (very) long list of elif causes segfault

2012-11-22 Thread Marc-Andre Lemburg
Marc-Andre Lemburg added the comment: On 22.11.2012 17:15, Serhiy Storchaka wrote: This may be a duplicate of issue5765. It's certainly similar, but this ticket is not about expressions, it's about statements that are meant to be repeated often, so in a way less artificial :-) It would be

[issue16527] (very) long list of elif causes segfault

2012-11-22 Thread Christian Heimes
Christian Heimes added the comment: I'm unable to reproduce the issue with 3.3 and default head. With v3.3.0 the script causes a segfault. I guess Serhiy has a point, the fix for #5765 also fixes this issue. -- ___ Python tracker

[issue16527] (very) long list of elif causes segfault

2012-11-22 Thread Serhiy Storchaka
Changes by Serhiy Storchaka storch...@gmail.com: -- nosy: +ncoghlan ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16527 ___ ___ Python-bugs-list

[issue16527] (very) long list of elif causes segfault

2012-11-22 Thread Benjamin Peterson
Changes by Benjamin Peterson benja...@python.org: -- status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16527 ___ ___

[issue16527] (very) long list of elif causes segfault

2012-11-21 Thread Alexis Daboville
New submission from Alexis Daboville: Hi, It looks like using a very long list of elif makes CPython segfault. You can try it with the attached file, which looks like this: if False: pass elif False: pass # thousands of elifs elif False: pass $ python elif_segfault.py

[issue16527] (very) long list of elif causes segfault

2012-11-21 Thread Alexis Daboville
Changes by Alexis Daboville alexis.dabovi...@gmail.com: -- components: +Interpreter Core type: - crash ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16527 ___

[issue16527] (very) long list of elif causes segfault

2012-11-21 Thread Christian Heimes
Christian Heimes added the comment: Nice catch! How did you notice the issue? I hope you didn't use thousands of elifs in some code. It's going to perform horrible slow with O(n). I'll see if we can fix the problem easily. As this is clearly a pathological case I consider a patch as nice to

[issue16527] (very) long list of elif causes segfault

2012-11-21 Thread Christian Heimes
Christian Heimes added the comment: Interesting, a debug build of Python doesn't segfault. $ 3.3/python elif_segfault.py RuntimeError: maximum recursion depth exceeded during compilation [41897 refs] $ python3.3 elif_segfault.py Speicherzugriffsfehler (Speicherabzug geschrieben) Backtrace: #0

[issue16527] (very) long list of elif causes segfault

2012-11-21 Thread Alexis Daboville
Alexis Daboville added the comment: I had the feeling that there was a possible issue when reading how elifs were represented in the AST. I'm not insane enough to write so many elifs in a real program ;). I totally agree on the 'nice to have' part rather than 'required'. --

[issue16527] (very) long list of elif causes segfault

2012-11-21 Thread Jesús Cea Avión
Changes by Jesús Cea Avión j...@jcea.es: -- nosy: +jcea ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16527 ___ ___ Python-bugs-list mailing list

[issue16527] (very) long list of elif causes segfault

2012-11-21 Thread Antoine Pitrou
Changes by Antoine Pitrou pit...@free.fr: -- nosy: +benjamin.peterson ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16527 ___ ___ Python-bugs-list