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


Groups > comp.lang.python > #95163

Re: except block isn't catching exception

References <48587161-1bd6-47e4-b2c9-7a37c60a59e5@googlegroups.com> <mailman.1286.1438908366.3674.python-list@python.org> <c0684935-c807-4d98-9a04-8c2f7986169d@googlegroups.com> <CAPTjJmqVQ2xftm7rxg+co0bTyafU_iQaEMu9gPgD-39z1qCa_w@mail.gmail.com> <CALwzidktXAjsTmx1v-Xqy7VfwW_W+rchMX9E2tj8E_cVju-RQQ@mail.gmail.com>
Date 2015-08-08 17:08 +1000
Subject Re: except block isn't catching exception
From Chris Angelico <rosuav@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.1331.1439017714.3674.python-list@python.org> (permalink)

Show all headers | View raw


On Sat, Aug 8, 2015 at 4:56 PM, Ian Kelly <ian.g.kelly@gmail.com> wrote:
> On Fri, Aug 7, 2015 at 8:44 PM, Chris Angelico <rosuav@gmail.com> wrote:
>> The exception isn't happening inside sock.accept(), as I explained. So
>> you can't catch it there.
>
> Where does the exception happen then? Your explanation only covered
> why the blocking call cannot be interrupted by it, not why the
> exception isn't simply raised when the blocking call finishes.
>

I'm not sure there's anything in the language spec about it; at least,
I can't find it. But the last time I was digging in the Python/C API,
there was a caveat that KeyboardInterrupt was raised *at some point
after* Ctrl-C was hit - a flag gets set, and after every N bytecode
instructions, the flag is checked, and then the signal gets raised. It
might happen on only some platforms, and I can't even find back the
page I was looking at when I read that. Maybe someone else knows?

ChrisA

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


Thread

except block isn't catching exception sohcahtoa82@gmail.com - 2015-08-06 17:34 -0700
  Re: except block isn't catching exception Chris Angelico <rosuav@gmail.com> - 2015-08-07 10:46 +1000
    Re: except block isn't catching exception sohcahtoa82@gmail.com - 2015-08-07 10:16 -0700
      Re: except block isn't catching exception Chris Angelico <rosuav@gmail.com> - 2015-08-08 12:44 +1000
      Re: except block isn't catching exception Ian Kelly <ian.g.kelly@gmail.com> - 2015-08-08 00:56 -0600
      Re: except block isn't catching exception Chris Angelico <rosuav@gmail.com> - 2015-08-08 17:08 +1000

csiph-web