diff options
author | Neal Norwitz <nnorwitz@gmail.com> | 2006-03-26 04:10:42 (GMT) |
---|---|---|
committer | Neal Norwitz <nnorwitz@gmail.com> | 2006-03-26 04:10:42 (GMT) |
commit | a8de08daefd6a10f952f57f9969e393220f890c1 (patch) | |
tree | deb864c954b4298e66f1b25007abeac0f66a7502 | |
parent | d9578f96ef8d85fc18c6b35ad0872d02609ad8a3 (diff) | |
download | cpython-a8de08daefd6a10f952f57f9969e393220f890c1.zip cpython-a8de08daefd6a10f952f57f9969e393220f890c1.tar.gz cpython-a8de08daefd6a10f952f57f9969e393220f890c1.tar.bz2 |
Backport:
Handle sys.getfilesystemencoding() returning None.
ascii seems like the safest bet, it should exist. I wonder if utf-8
would be a better choice? This should get test_fileinput passing on OpenBSD.
-rw-r--r-- | Lib/test/test_fileinput.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/Lib/test/test_fileinput.py b/Lib/test/test_fileinput.py index 285573c..71b98be 100644 --- a/Lib/test/test_fileinput.py +++ b/Lib/test/test_fileinput.py @@ -162,7 +162,10 @@ if verbose: print "15. Unicode filenames" try: 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) verify(lines == ["A\n", "B"]) finally: |