summaryrefslogtreecommitdiff
path: root/Tools
diff options
context:
space:
mode:
authorChristian Heimes <christian@cheimes.de>2013-11-23 21:14:01 +0100
committerChristian Heimes <christian@cheimes.de>2013-11-23 21:14:01 +0100
commit310e4c43cd87df44b170acf43f63cb94d00321c5 (patch)
treea0f7a9343a149ed2d0709f7f463e33903f6f56d5 /Tools
parente8b1ba1699d429b1e80ea7d31032628d09c3e43e (diff)
parentdd52c5a1c46b4d8e42e5e7a00f9b307f113de08d (diff)
downloadcpython-git-310e4c43cd87df44b170acf43f63cb94d00321c5.tar.gz
merge
Diffstat (limited to 'Tools')
-rw-r--r--Tools/iobench/iobench.py4
-rwxr-xr-xTools/scripts/diff.py4
-rwxr-xr-xTools/scripts/ndiff.py2
3 files changed, 6 insertions, 4 deletions
diff --git a/Tools/iobench/iobench.py b/Tools/iobench/iobench.py
index 530bc79d5c..712e58472e 100644
--- a/Tools/iobench/iobench.py
+++ b/Tools/iobench/iobench.py
@@ -24,6 +24,8 @@ def text_open(fn, mode, encoding=None):
try:
return open(fn, mode, encoding=encoding or TEXT_ENCODING)
except TypeError:
+ if 'r' in mode:
+ mode += 'U' # 'U' mode is needed only in Python 2.x
return open(fn, mode)
def get_file_sizes():
@@ -380,7 +382,7 @@ def prepare_files():
f.write(os.urandom(size))
# Text files
chunk = []
- with text_open(__file__, "rU", encoding='utf8') as f:
+ with text_open(__file__, "r", encoding='utf8') as f:
for line in f:
if line.startswith("# <iobench text chunk marker>"):
break
diff --git a/Tools/scripts/diff.py b/Tools/scripts/diff.py
index f9b14bf5e5..8be527fd62 100755
--- a/Tools/scripts/diff.py
+++ b/Tools/scripts/diff.py
@@ -38,9 +38,9 @@ def main():
fromdate = file_mtime(fromfile)
todate = file_mtime(tofile)
- with open(fromfile, 'U') as ff:
+ with open(fromfile) as ff:
fromlines = ff.readlines()
- with open(tofile, 'U') as tf:
+ with open(tofile) as tf:
tolines = tf.readlines()
if options.u:
diff --git a/Tools/scripts/ndiff.py b/Tools/scripts/ndiff.py
index 2422091dcc..c6d09b8f24 100755
--- a/Tools/scripts/ndiff.py
+++ b/Tools/scripts/ndiff.py
@@ -60,7 +60,7 @@ def fail(msg):
# couldn't be opened
def fopen(fname):
try:
- return open(fname, 'U')
+ return open(fname)
except IOError as detail:
return fail("couldn't open " + fname + ": " + str(detail))