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

* Enforce that Display.display requires a str

* clog frag

* ci_complete
pull/80338/head
Matt Martz 2 years ago committed by GitHub
parent bf74f390af
commit 9faf94468b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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

Loading…
Cancel
Save