Commit c92070e8 authored by Georg Brandl's avatar Georg Brandl

Patch #1337756: fileinput now accepts Unicode filenames.

parent 20812a08
...@@ -184,7 +184,7 @@ class FileInput: ...@@ -184,7 +184,7 @@ class FileInput:
""" """
def __init__(self, files=None, inplace=0, backup="", bufsize=0): def __init__(self, files=None, inplace=0, backup="", bufsize=0):
if type(files) == type(''): if isinstance(files, basestring):
files = (files,) files = (files,)
else: else:
if files is None: if files is None:
......
...@@ -157,3 +157,13 @@ try: ...@@ -157,3 +157,13 @@ try:
verify(fi.lineno() == 6) verify(fi.lineno() == 6)
finally: finally:
remove_tempfiles(t1, t2) 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)
...@@ -366,6 +366,8 @@ Extension Modules ...@@ -366,6 +366,8 @@ Extension Modules
Library Library
------- -------
- Patch #1337756: fileinput now accepts Unicode filenames.
- Patch #1373643: The chunk module can now read chunks larger than - Patch #1373643: The chunk module can now read chunks larger than
two gigabytes. two gigabytes.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment