[Python-3000] Exception re-raising woes

Guido van Rossum guido at python.org
Fri May 30 19:30:53 CEST 2008


The issue you're raising is deep. subtle and complex -- I can't quite
fathom your proposal, and expect I'd have to spend at least an hour
with the source code before I could truly understand the issue and the
proposal. I haven't done that yet, so take the following with a grain
of salt.

That said, it seems you are proposing taking the logical consequence
of making except handlers properly nested and scoped, and if you can
come up with a patch to implement this, I think I could support it.

I would be okay as well with restricting bare raise syntactically to
appearing only inside an except block, to emphasize the change in
semantics that was started when we decided to make the optional
variable disappear at the end of the except block.

This would render the following code illegal:

def f():
  try: 1/0
  except: pass
  raise

I am fine with that, even if there are probably some uses of it that
may be a little tricky to rewrite. (The same happened when we reduced
the variable scope.)

--Guido

On Fri, May 30, 2008 at 2:51 AM, Antoine Pitrou <solipsis at pitrou.net> wrote:
>
> Hi,
>
> I'm surprised that nobody except Robert Brewer reacted to my proposal. The two
> relevant bugs (#2507 and #2833) have been marked respectively as "critical" and
> "release blocker", so I thought at least some people felt concerned :-)
>
> Should I wait a bit for people to react and give a qualified opinion, or should
> I assume one of the following implicit answers (and if so, which one!):
>
> - we don't really care about re-raising, just fix #2507 the simple way so that
> exception state is properly cleaned up
> - we must fix both #2507 and #2833 in a clean way, and your proposal looks fine
> - we must fix both #2507 and #2833 in a clean way, but your proposal is
> completely bogus
>
> cheers
>
> Antoine.
>
>
> _______________________________________________
> Python-3000 mailing list
> Python-3000 at python.org
> http://mail.python.org/mailman/listinfo/python-3000
> Unsubscribe: http://mail.python.org/mailman/options/python-3000/guido%40python.org
>



-- 
--Guido van Rossum (home page: http://www.python.org/~guido/)


More information about the Python-3000 mailing list