Skip to content

Add support for old-style exception objects.#58

Merged
agronholm merged 1 commit intoagronholm:masterfrom
rhansen:old-style-exceptions
Feb 24, 2017
Merged

Add support for old-style exception objects.#58
agronholm merged 1 commit intoagronholm:masterfrom
rhansen:old-style-exceptions

Conversation

@rhansen
Copy link
Copy Markdown
Contributor

@rhansen rhansen commented Dec 29, 2016

Python 2 permits raising old-style objects (objects that aren't instances of the object class). Because these objects are not instances of BaseException, clauses like except BaseException: don't catch them.

Add support for handling old-style exception objects by:

  • using a class-less except: clause to catch old-style objects raised by tasks and done callbacks
  • using the proper exception object class type when raising a stored old-type exception during result()

@rhansen rhansen force-pushed the old-style-exceptions branch 2 times, most recently from c2315c1 to ac23179 Compare December 29, 2016 21:00
@rhansen rhansen force-pushed the old-style-exceptions branch from ac23179 to 6312c3d Compare January 11, 2017 02:14
Python 2 permits raising old-style objects (objects that aren't
instances of the object class).  Because these objects are not
instances of BaseException, clauses like 'except BaseException:'
don't catch them.

Add support for handling old-style exception objects by:

  * using a class-less 'except:' clause to catch old-style objects
    raised by tasks and done callbacks
  * using the proper exception object class type when raising a stored
    old-type exception during result()
@rhansen
Copy link
Copy Markdown
Contributor Author

rhansen commented Feb 21, 2017

This is sort-of blocking python/typeshed#946.

@agronholm agronholm merged commit e5a9e9b into agronholm:master Feb 24, 2017
@agronholm
Copy link
Copy Markdown
Owner

Thanks!

@rhansen rhansen deleted the old-style-exceptions branch February 24, 2017 20:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants