]> granicus.if.org Git - python/commitdiff
Fix for glob.py if filesystem encoding is None.
authorGeorg Brandl <georg@python.org>
Tue, 20 Mar 2007 23:05:14 +0000 (23:05 +0000)
committerGeorg Brandl <georg@python.org>
Tue, 20 Mar 2007 23:05:14 +0000 (23:05 +0000)
Lib/glob.py

index a92b11f431bd88a20cbec5239bf22aae0e75bba0..75d7bf94e5b2765a469a180fd11b2ff9a067fbd4 100644 (file)
@@ -50,7 +50,8 @@ def glob1(dirname, pattern):
     if not dirname:
         dirname = os.curdir
     if isinstance(pattern, unicode) and not isinstance(dirname, unicode):
-        dirname = unicode(dirname, sys.getfilesystemencoding())
+        dirname = unicode(dirname, sys.getfilesystemencoding() or
+                                   sys.getdefaultencoding())
     try:
         names = os.listdir(dirname)
     except os.error: