mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-08 13:04:46 +08:00
third_party/2/concurrent/futures is for the Python 2 backport of the concurrent.futures package from Python 3. In Python 3, all exceptions are derived from BaseException, but Python 2 also supports exceptions that are old-style objects (which don't derive from BaseException). Switch from BaseException to Any to allow old-style exceptions. All old-style objects are instances of types.InstanceType, so an alternative to Any is Union[BaseException, types.InstanceType]. This would help avoid accidentally passing a non-BaseException new-style object to Future.set_exception(). However, only Executors call that function (usually), and it's not clear that mypy understands old-style objects and their relationship to types.InstanceType, so Any is thought to be the more practical choice.