Commit 2c85d826 authored by Neal Norwitz's avatar Neal Norwitz

Try to handle sys.getfilesystemencoding() returning None.

ascii seems like the safest bet that it will exist.  I wonder if utf-8
would be a better choice?  This should get test_fileinput passing on OpenBSD.
parent 334b5b20
...@@ -162,7 +162,10 @@ if verbose: ...@@ -162,7 +162,10 @@ if verbose:
print "15. Unicode filenames" print "15. Unicode filenames"
try: try:
t1 = writeTmp(1, ["A\nB"]) t1 = writeTmp(1, ["A\nB"])
fi = FileInput(files=unicode(t1, sys.getfilesystemencoding())) encoding = sys.getfilesystemencoding()
if encoding is None:
encoding = 'ascii'
fi = FileInput(files=unicode(t1, encoding))
lines = list(fi) lines = list(fi)
verify(lines == ["A\n", "B"]) verify(lines == ["A\n", "B"])
finally: finally:
......
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