diff options
author | Georg Brandl <georg@python.org> | 2006-02-19 09:51:33 (GMT) |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2006-02-19 09:51:33 (GMT) |
commit | 044d2ce37c08f542c2c4f8b0ee4582ff06cbfb68 (patch) | |
tree | f1c1b88a89ed96f0a4d9af385b1290702b6adcc9 | |
parent | 465548111d1deb11c3ee2f67ea770fbecfea6640 (diff) | |
download | cpython-044d2ce37c08f542c2c4f8b0ee4582ff06cbfb68.zip cpython-044d2ce37c08f542c2c4f8b0ee4582ff06cbfb68.tar.gz cpython-044d2ce37c08f542c2c4f8b0ee4582ff06cbfb68.tar.bz2 |
Patch #1337756: fileinput now accepts Unicode filenames.
-rw-r--r-- | Lib/fileinput.py | 2 | ||||
-rw-r--r-- | Lib/test/test_fileinput.py | 10 | ||||
-rw-r--r-- | Misc/NEWS | 2 |
3 files changed, 13 insertions, 1 deletions
diff --git a/Lib/fileinput.py b/Lib/fileinput.py index 27ccc3b..5c06627 100644 --- a/Lib/fileinput.py +++ b/Lib/fileinput.py @@ -184,7 +184,7 @@ class FileInput: """ def __init__(self, files=None, inplace=0, backup="", bufsize=0): - if type(files) == type(''): + if isinstance(files, basestring): files = (files,) else: if files is None: diff --git a/Lib/test/test_fileinput.py b/Lib/test/test_fileinput.py index 3a82c7c..285573c 100644 --- a/Lib/test/test_fileinput.py +++ b/Lib/test/test_fileinput.py @@ -157,3 +157,13 @@ try: verify(fi.lineno() == 6) finally: remove_tempfiles(t1, t2) + +if verbose: + print "15. Unicode filenames" +try: + t1 = writeTmp(1, ["A\nB"]) + fi = FileInput(files=unicode(t1, sys.getfilesystemencoding())) + lines = list(fi) + verify(lines == ["A\n", "B"]) +finally: + remove_tempfiles(t1) @@ -74,6 +74,8 @@ Extension Modules Library ------- +- Patch #1337756: fileinput now accepts Unicode filenames. + - Patch #1373643: The chunk module can now read chunks larger than two gigabytes. |