Fatal Python error

Joshua Landau joshua.landau.ws at gmail.com
Wed May 29 10:05:52 EDT 2013


On 29 May 2013 14:02, Dave Angel <davea at davea.name> wrote:

> On 05/29/2013 08:45 AM, Oscar Benjamin wrote:
> Joshua:  Avoid doing anything complex inside an exception handler.


Unfortunately, Ranger (the file manager in question) wraps a lot of stuff
in one big exception handler. Hence there isn't much choice. The original
wasn't actually in an infinite recursion, too, but just a recursion over a
large directory.

Is there a reason that Python 3 can't be made to work like Python 2 and
PyPy, and -if not- should it? The catchable fail would be much nicer than
just bombing the program.

In the meantime the algorithm should just be reworked, but it seems like a
larger step than should be needed.

If nothing else, the exception frame is huge.  I probably would have
> spotted it except for the indentation problem triggered by html.  The top
> level code following your function didn't have any loops, so it wasn't a
> problem.
>
> Can anyone help Joshua put his gmail into text mode?


I've found a new option. As a test, here's a simplified version without the
property:

def loop():
    try:
        (lambda: None)()
    except:
        pass

    loop()

try:
    loop()
except RuntimeError:
    pass

which is pretty much Oscar Benjamin's, but less stupid.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20130529/f25d2169/attachment.html>


More information about the Python-list mailing list