Byte type comparisons on the output queue
authorJeremy Stanley <fungi@yuggoth.org>
Tue, 17 Sep 2013 08:13:03 +0000 (08:13 +0000)
committerJeremy Stanley <fungi@yuggoth.org>
Tue, 17 Sep 2013 08:13:03 +0000 (08:13 +0000)
* lib/mudpy/misc.py: When comparing against data already in the output
queue, use byte type for compatibility with Py3K.

lib/mudpy/misc.py

index 2fe8e6f..b39610b 100644 (file)
@@ -800,12 +800,12 @@ class User:
             # and the ansi escape to return to normal text
             if not just_prompt and prepend_padding:
                 if not self.output_queue \
-                   or not self.output_queue[-1].endswith("\r\n"):
+                   or not self.output_queue[-1].endswith(b"\r\n"):
                     output = "$(eol)" + output
                 elif not self.output_queue[-1].endswith(
-                    "\r\n\x1b[0m\r\n"
+                    b"\r\n\x1b[0m\r\n"
                 ) and not self.output_queue[-1].endswith(
-                    "\r\n\r\n"
+                    b"\r\n\r\n"
                 ):
                     output = "$(eol)" + output
             output += eol + chr(27) + "[0m"