mirror of
https://github.com/ansible/ansible.git
synced 2026-08-04 08:03:41 +02:00
swallow all exceptions in type annotation support shim imports (#77860)
* swallow all exceptions in type annotation support shim imports * add changelog
This commit is contained in:
@@ -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
|
# 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:
|
try:
|
||||||
from typing_extensions import *
|
from typing_extensions import *
|
||||||
except ImportError:
|
except Exception: # pylint: disable=broad-except
|
||||||
pass
|
pass
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from typing import * # type: ignore[misc]
|
from typing import * # type: ignore[misc]
|
||||||
except ImportError:
|
except Exception: # pylint: disable=broad-except
|
||||||
pass
|
pass
|
||||||
|
|||||||
Reference in New Issue
Block a user