Prefer using repr() on the Dev cog results (excl. str instances) (#6726)

This commit is contained in:
Jakub Kuczys
2026-04-03 02:05:54 +02:00
committed by GitHub
parent ee1db01a2f
commit fcb8bc0265

View File

@@ -158,7 +158,7 @@ class DevOutput:
output.append(self.formatted_exc) output.append(self.formatted_exc)
elif self.always_include_result or self.result is not None: elif self.always_include_result or self.result is not None:
try: try:
result = str(self.result) result = str(self.result) if isinstance(self.result, str) else repr(self.result)
# ensure that the result can be encoded (GH-6485) # ensure that the result can be encoded (GH-6485)
result.encode("utf-8") result.encode("utf-8")
except Exception as exc: except Exception as exc: