]> granicus.if.org Git - python/commitdiff
Try to handle sys.getfilesystemencoding() returning None.
authorNeal Norwitz <nnorwitz@gmail.com>
Sun, 26 Mar 2006 03:11:57 +0000 (03:11 +0000)
committerNeal Norwitz <nnorwitz@gmail.com>
Sun, 26 Mar 2006 03:11:57 +0000 (03:11 +0000)
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.

Lib/test/test_fileinput.py

index f3a7841990de944c766a161e71bc6a5e1c1ecbd1..301769e4f568e4e7a37f4037e3ff43c8da3c3d59 100644 (file)
@@ -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: