Patch #1337756: fileinput now accepts Unicode filenames.

This commit is contained in:
Georg Brandl 2006-02-19 09:51:27 +00:00
parent e9b1949f70
commit e466217ab9
3 changed files with 13 additions and 1 deletions

View File

@ -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:

View File

@ -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)

View File

@ -366,6 +366,8 @@ Extension Modules
Library
-------
- Patch #1337756: fileinput now accepts Unicode filenames.
- Patch #1373643: The chunk module can now read chunks larger than
two gigabytes.