Enforce that Display.display requires a str (#80327)

* Enforce that Display.display requires a str

* clog frag

* ci_complete
This commit is contained in:
Matt Martz
2023-03-28 10:41:02 -05:00
committed by GitHub
parent bf74f390af
commit 9faf94468b
2 changed files with 5 additions and 0 deletions

View 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

View File

@@ -326,6 +326,9 @@ class Display(metaclass=Singleton):
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 _final_q is set, that means we are in a WorkerProcess
# and instead of displaying messages directly from the fork