Catch-all exceptions don't make an exception for GeneratorExit

Create issue
Issue #115 resolved
Floris Bruynooghe created an issue

Hi

pylib seems to often use {{{ try: ... except (KeyboardInterrupt, SystemExit): raise except: ... }}} However this currently misses GeneratorExit and might miss other exceptions which don't (and shouldn't) inherit from Exception in the future.

Unfortunately the hierarchy only got rearranged in python 2.5 and GeneratorExit was only present since 2.5. So maybe this can't be solved until 2.4 is no longer supported.

Regards Floris

Comments (4)

  1. Holger Krekel repo owner

    py.builtin.* provides helpers, among them py.builtin.GeneratorExit, to help working across Python versions.

    I guess we could actually introduce a 'py.builtin.Exception' and start consistently re-raising this everywhere.

  2. Holger Krekel repo owner

    Ronny went through the code base to replace exception catching with py.builtin._sysex which now includes GeneratorExit. We could not implement the "except Exception" approach i mentioned because this does not work consistently with <Python2.6. If you find more occurences please submit patches or ping us on IRC. cheers, holger

  3. Log in to comment