summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--changelogs/fragments/71704_selector.yml2
-rw-r--r--lib/ansible/module_utils/basic.py2
2 files changed, 3 insertions, 1 deletions
diff --git a/changelogs/fragments/71704_selector.yml b/changelogs/fragments/71704_selector.yml
new file mode 100644
index 0000000000..0ad93284f8
--- /dev/null
+++ b/changelogs/fragments/71704_selector.yml
@@ -0,0 +1,2 @@
+bugfixes:
+- basic - handle exceptions for default selectors in Python 2.7 (https://github.com/ansible/ansible/issues/71704).
diff --git a/lib/ansible/module_utils/basic.py b/lib/ansible/module_utils/basic.py
index 00a04bf904..1d03d5a209 100644
--- a/lib/ansible/module_utils/basic.py
+++ b/lib/ansible/module_utils/basic.py
@@ -2712,7 +2712,7 @@ class AnsibleModule(object):
stderr = b''
try:
selector = selectors.DefaultSelector()
- except OSError:
+ except (IOError, OSError):
# Failed to detect default selector for the given platform
# Select PollSelector which is supported by major platforms
selector = selectors.PollSelector()