changeset 36023:adec6374a0b2

py3: replace file() with open() in test-mactext.t file() is not present in Python 3. This patch also adds a b'' prefix to make sure we write bytes in Python 3. Differential Revision: https://phab.mercurial-scm.org/D2122
author Pulkit Goyal <7895pulkit@gmail.com>
date Sun, 11 Feb 2018 17:07:09 +0530
parents b911995040f9
children 2a81ed6c3bb9
files tests/test-mactext.t
diffstat 1 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/tests/test-mactext.t	Sun Feb 11 17:06:04 2018 +0530
+++ b/tests/test-mactext.t	Sun Feb 11 17:07:09 2018 +0530
@@ -3,9 +3,9 @@
   > import sys
   > 
   > for path in sys.argv[1:]:
-  >     data = file(path, 'rb').read()
-  >     data = data.replace('\n', '\r')
-  >     file(path, 'wb').write(data)
+  >     data = open(path, 'rb').read()
+  >     data = data.replace(b'\n', b'\r')
+  >     open(path, 'wb').write(data)
   > EOF
   $ cat > print.py <<EOF
   > import sys