[Python-checkins] r43323 - python/branches/release24-maint/Lib/test/test_fileinput.py

neal.norwitz python-checkins at python.org
Sun Mar 26 06:10:43 CEST 2006


Author: neal.norwitz
Date: Sun Mar 26 06:10:42 2006
New Revision: 43323

Modified:
   python/branches/release24-maint/Lib/test/test_fileinput.py
Log:
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.


Modified: python/branches/release24-maint/Lib/test/test_fileinput.py
==============================================================================
--- python/branches/release24-maint/Lib/test/test_fileinput.py	(original)
+++ python/branches/release24-maint/Lib/test/test_fileinput.py	Sun Mar 26 06:10:42 2006
@@ -162,7 +162,10 @@
     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:


More information about the Python-checkins mailing list