From: Neal Norwitz Date: Sun, 26 Mar 2006 04:10:42 +0000 (+0000) Subject: Backport: X-Git-Tag: v2.4.3~12 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a8de08daefd6a10f952f57f9969e393220f890c1;p=thirdparty%2FPython%2Fcpython.git 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. --- diff --git a/Lib/test/test_fileinput.py b/Lib/test/test_fileinput.py index 285573cc8ec0..71b98be51f4a 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: