mirror of
https://github.com/ansible/ansible-documentation.git
synced 2026-03-27 13:28:51 +07:00
Enforce that Display.display requires a str (#80327)
* Enforce that Display.display requires a str * clog frag * ci_complete
This commit is contained in:
2
changelogs/fragments/display-display-str-only.yml
Normal file
2
changelogs/fragments/display-display-str-only.yml
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
bugfixes:
|
||||||
|
- Perform type check on data passed to Display.display to enforce the requirement of being given a python3 unicode string
|
||||||
@@ -326,6 +326,9 @@ class Display(metaclass=Singleton):
|
|||||||
Note: msg *must* be a unicode string to prevent UnicodeError tracebacks.
|
Note: msg *must* be a unicode string to prevent UnicodeError tracebacks.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
if not isinstance(msg, str):
|
||||||
|
raise TypeError(f'Display message must be str, not: {msg.__class__.__name__}')
|
||||||
|
|
||||||
if self._final_q:
|
if self._final_q:
|
||||||
# If _final_q is set, that means we are in a WorkerProcess
|
# If _final_q is set, that means we are in a WorkerProcess
|
||||||
# and instead of displaying messages directly from the fork
|
# and instead of displaying messages directly from the fork
|
||||||
|
|||||||
Reference in New Issue
Block a user