Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #46375

Re: Fatal Python error

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!xlned.com!feeder3.xlned.com!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <joshua.landau.ws@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.001
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'subject:error': 0.03; 'interpreter': 0.05; 'subject:Python': 0.06; 'element': 0.07; 'level,': 0.07; 'pypy': 0.07; 'except:': 0.09; 'extracted': 0.09; 'logic': 0.09; 'overflow': 0.09; 'try:': 0.09; 'cc:addr:python- list': 0.11; 'python': 0.11; 'def': 0.12; 'creates': 0.14; 'crashed': 0.16; 'justified': 0.16; 'occurs.': 0.16; 'then?': 0.16; 'valueerror,': 0.16; 'why,': 0.16; 'exception': 0.16; 'weird': 0.16; 'wrote:': 0.18; 'code.': 0.18; 'stack': 0.19; 'seems': 0.21; 'code,': 0.22; 'email addr:gmail.com&gt;': 0.22; 'cc:addr:python.org': 0.22; 'error': 0.23; 'skip:\xa0 20': 0.24; 'cc:2**0': 0.24; "i've": 0.25; '&gt;': 0.26; 'handling': 0.26; 'pass': 0.26; 'code:': 0.26; 'defined': 0.27; 'header:In-Reply- To:1': 0.27; 'tried': 0.27; 'function': 0.29; 'message- id:@mail.gmail.com': 0.30; "i'm": 0.30; 'code': 0.31; 'catching': 0.31; 'exceptions': 0.31; 'informative': 0.31; 'file': 0.32; 'up.': 0.33; 'core': 0.34; "i'd": 0.34; 'something': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'similar': 0.36; 'should': 0.36; 'error.': 0.37; 'level': 0.37; 'expected': 0.38; 'skip:& 10': 0.38; 'manager': 0.38; 'handle': 0.38; 'little': 0.38; 'expect': 0.39; 'does': 0.39; 'itself': 0.39; 'though,': 0.39; '\xa0\xa0\xa0': 0.39; 'enough': 0.39; 'skip:u 10': 0.60; 'removing': 0.60; 'lower': 0.61; 'new': 0.61; 'simply': 0.61; 'to:addr:gmail.com': 0.65; 'here': 0.66; 'statement,': 0.68; 'caused': 0.69; '3.3.1': 0.84; 'disturb': 0.91; 'not:': 0.91; 'recover': 0.91; 'imagine': 0.93; '2013': 0.98
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=HahMvIUTwjvNIJnx7Sn5pNDRuRDDr07ZsYRkK5N6Chg=; b=Xz4YR0sP15v6JO4p/wMZHUsOwZ3yuswkc6ZazdOzNr+0u2wq/kOFbnpWMfgGEiS4Aa BpudmUc+0Yl/6fX5Kmk3qp1zKw0wuDk9SVIO57/v9t6r2DoKm5bui43tZ18TAnsbm+O/ mlkoC38a+E04TBKFjXTTh6mrBX6gTZAWZWxMGNBvb0qYIraPxT/BQUuhKugmG6hKy98h cJtvsL6nOUNspbHDfhO0yfnWeY6SvUni2XQ8c1qSnrGgJpB47MlywiZA2HMp44689UBh hDxopMLdjHaCGvA+Ymo5LJKa03Bz0ZPJv2sbvFzeJHZCeC8O0HIOVkC7QEqMo4aAqKan /KPg==
X-Received by 10.112.138.100 with SMTP id qp4mr1568870lbb.84.1369832615472; Wed, 29 May 2013 06:03:35 -0700 (PDT)
MIME-Version 1.0
In-Reply-To <CAFEv2m6DdXK-c1YLn+6D5E1RHZ+p-AQ=2eqEh7c6Ls61+=ZAhQ@mail.gmail.com>
References <CAN1F8qXPEM4B=2e7KOhWeTKzxmeeb_w_S97wYiHCMXH3jfzL6g@mail.gmail.com> <CAFEv2m6DdXK-c1YLn+6D5E1RHZ+p-AQ=2eqEh7c6Ls61+=ZAhQ@mail.gmail.com>
From Joshua Landau <joshua.landau.ws@gmail.com>
Date Wed, 29 May 2013 14:02:54 +0100
Subject Re: Fatal Python error
To Marcel Rodrigues <marcelgmr@gmail.com>
Content-Type multipart/alternative; boundary=089e0118329a72723504dddb028c
Cc python-list <python-list@python.org>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.2355.1369832617.3114.python-list@python.org> (permalink)
Lines 99
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1369832617 news.xs4all.nl 15866 [2001:888:2000:d::a6]:57701
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:46375

Show key headers only | View raw


[Multipart message — attachments visible in raw view] - view raw

On 29 May 2013 13:30, Marcel Rodrigues <marcelgmr@gmail.com> wrote:
>
> I just tried your code with similar results: it does nothing on PyPy
2.0.0-beta2 and Python 2.7.4. But on Python 3.3.1 it caused core dump.
> It's a little weird but so is the code. You have defined a function that
calls itself unconditionally. This will cause a stack overflow, which is a
RuntimeError.


The weirdness of the code is simply as I've taken all the logic and
conditionality away, since it was irrelevant. Why, though, does removing
any one element make it fail properly? That's what's confusing, largely.

>
>  Since you are handling this very exception with a pass statement, we
would expect that no error occurs. But the fatal error message seems pretty
informative at this point: "Cannot recover from stack overflow.".
>
> One thing to note is that while it's reasonable to handle exceptions that
happens at the level of your Python code, like a ValueError, it's not so
reasonable to try to handle something that may disturb the interpreter
itself in a lower level, like a stack overflow (I think that the stack used
by your code is the same stack used by the interpreter code, but I'm not
sure).


What is the expected response here then? Should I ever feel justified in
catching a Stack Overflow error? This code was extracted from a file
manager after much difficulty, but it should have been "caught" by a global
try...except and not crashed the whole program immediately. I'd imagine
that's a good enough reason to bring this up.



Also;
This works for the code:

def loop():
    thingwithproperty.prop
    loop()

This does not:

def loop():
    try:
        thingwithproperty.prop
    except:
        pass
loop()

thingwithproperty.prop NEVER creates an error.
(.prop is the new .property)

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: Fatal Python error Joshua Landau <joshua.landau.ws@gmail.com> - 2013-05-29 14:02 +0100

csiph-web