swallow all exceptions in type annotation support shim imports (#77860)

* swallow all exceptions in type annotation support shim imports

* add changelog
pull/77913/head
Matt Davis 2 years ago committed by GitHub
parent e7e1d592a6
commit 813afcbbb4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -0,0 +1,2 @@
bugfixes:
- prevent type annotation shim failures from causing runtime failures (https://github.com/ansible/ansible/pull/77860)

@ -4,12 +4,15 @@ __metaclass__ = type
# pylint: disable=wildcard-import,unused-wildcard-import
# catch *all* exceptions to prevent type annotation support module bugs causing runtime failures
# (eg, https://github.com/ansible/ansible/issues/77857)
try:
from typing_extensions import *
except ImportError:
except Exception: # pylint: disable=broad-except
pass
try:
from typing import * # type: ignore[misc]
except ImportError:
except Exception: # pylint: disable=broad-except
pass

Loading…
Cancel
Save