diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2013-11-23 20:12:06 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2013-11-23 20:12:06 (GMT) |
commit | 6787a3806ee6a85a6f21ede70c10e15a6df267c4 (patch) | |
tree | d72149a2f3a4eab3e8f288fa2a25bb1957620d91 /Tools/iobench | |
parent | d41c343f28bd7631cfa866f8276673ccafb71d57 (diff) | |
download | cpython-6787a3806ee6a85a6f21ede70c10e15a6df267c4.zip cpython-6787a3806ee6a85a6f21ede70c10e15a6df267c4.tar.gz cpython-6787a3806ee6a85a6f21ede70c10e15a6df267c4.tar.bz2 |
Issue #15204: Deprecated the 'U' mode in file-like objects.
Diffstat (limited to 'Tools/iobench')
-rw-r--r-- | Tools/iobench/iobench.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/Tools/iobench/iobench.py b/Tools/iobench/iobench.py index 530bc79..712e584 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 |