]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
backport 1.14:
authorAnthony Baxter <anthonybaxter@gmail.com>
Thu, 10 Jan 2002 15:51:52 +0000 (15:51 +0000)
committerAnthony Baxter <anthonybaxter@gmail.com>
Thu, 10 Jan 2002 15:51:52 +0000 (15:51 +0000)
  Fix the second reincarnation of SF #456395 -- failure on IRIX.  This
  time use .replace() to change all \r\n into \n, not just the last one.

This makes test_pty work on Irix.

Lib/test/test_pty.py

index b119f6275fa199f36de320284952e75ad24433c4..5ea36008e0b47d5059fd392f2d5a5be8a379a9ef 100644 (file)
@@ -34,17 +34,13 @@ if not os.isatty(slave_fd):
 debug("Writing to slave_fd")
 os.write(slave_fd, TEST_STRING_1)
 s1 = os.read(master_fd, 1024)
-if s1[-2:] == "\r\n":
-    s1 = s1[:-2] + "\n"
-sys.stdout.write(s1)
+sys.stdout.write(s1.replace("\r\n", "\n"))
 
 debug("Writing chunked output")
 os.write(slave_fd, TEST_STRING_2[:5])
 os.write(slave_fd, TEST_STRING_2[5:])
 s2 = os.read(master_fd, 1024)
-if s2[-2:] == "\r\n":
-    s2 = s2[:-2] + "\n"
-sys.stdout.write(s2)
+sys.stdout.write(s2.replace("\r\n", "\n"))
 
 os.close(slave_fd)
 os.close(master_fd)