[issue6028] Interpreter crashes when chaining an infinite number of exceptions

2009-05-16 Thread Antoine Pitrou
Antoine Pitrou pit...@free.fr added the comment: The code you posted causes an infinite loop in the 2.x branch as well. Anyway, I do not see how crashing is a desired result. I do not see what the desired result is in your example. The code is obviously wrong. Did you get hit by that in

[issue6028] Interpreter crashes when chaining an infinite number of exceptions

2009-05-16 Thread Yury
Yury yury.sobo...@gmail.com added the comment: I knew that python handles infinite recursion and gracefully errors out, and I knew that exception chaining was new to 3.0, so I wanted to see if they would work together. Apparently, they do not. Yet, the code works fine in the 2.x branch. So, the

[issue6028] Interpreter crashes when chaining an infinite number of exceptions

2009-05-16 Thread Antoine Pitrou
Antoine Pitrou pit...@free.fr added the comment: While we seem to disagree on whether this a real bug (and I'll leave it at that), I'll just stress once again that a fatal error is totally different from an uncontrolled crash like a segmentation fault -- as I explained and although you don't

[issue6028] Interpreter crashes when chaining an infinite number of exceptions

2009-05-16 Thread Amaury Forgeot d'Arc
Amaury Forgeot d'Arc amaur...@gmail.com added the comment: You should be in control of all the code running in your own program This is not the case with applications that embed Python to provide users a way to script the application. All the usages of Py_FatalError I've seen detect

[issue6028] Interpreter crashes when chaining an infinite number of exceptions

2009-05-16 Thread Benjamin Peterson
Benjamin Peterson benja...@python.org added the comment: Well, perhaps something like #1195571 should be added. -- nosy: +benjamin.peterson ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6028

[issue6028] Interpreter crashes when chaining an infinite number of exceptions

2009-05-15 Thread Yury
New submission from Yury yury.sobo...@gmail.com: def error_handle(): try: print(5/0) except: error_handle() error_handle() Fatal Python error: Cannot recover from stack overflow. Aborted The interpreter should not crash. Perhaps a RuntimeError should be thrown instead.

[issue6028] Interpreter crashes when chaining an infinite number of exceptions

2009-05-15 Thread Antoine Pitrou
Antoine Pitrou pit...@free.fr added the comment: This is normal behaviour, actually. The RuntimeError *is* raised, but you catch it in the except clause and then recurse again ad infinitum. The interpreter realizes that it cannot recover from stack overflow, as the message says, and then bails

[issue6028] Interpreter crashes when chaining an infinite number of exceptions

2009-05-15 Thread Amaury Forgeot d'Arc
Amaury Forgeot d'Arc amaur...@gmail.com added the comment: Hmm, the interpreter should not crash so easily with pyre Python code. (The same code correctly raises RuntimeException wich python 2.x) The issue should be corrected IMO. The exact behavior seem to depend on where the recursion limit

[issue6028] Interpreter crashes when chaining an infinite number of exceptions

2009-05-15 Thread Antoine Pitrou
Antoine Pitrou pit...@free.fr added the comment: Amaury, your patch might make some individual cases better, but it won't prevent a FatalError from occurring in all cases. Also, it makes things worse in the following case: def recurse(): try: recurse() except: recurse()

[issue6028] Interpreter crashes when chaining an infinite number of exceptions

2009-05-15 Thread Yury
Yury yury.sobo...@gmail.com added the comment: The code you posted causes an infinite loop in the 2.x branch as well. Anyway, I do not see how crashing is a desired result. An infinite loop means the programmer made a mistake somewhere. A crash means the interpreter did. --