[PATCH] default _fs_enc to 'ascii' when sys.getfilesystemencoding() is nil.

Bart Teeuwisse bart-gmane at thecodemill.biz
Mon Oct 9 18:20:21 BST 2006


Title and comments below say it all.

/Bart

=== modified file 'bzrlib/osutils.py'
--- bzrlib/osutils.py   2006-09-15 00:44:57 +0000
+++ bzrlib/osutils.py   2006-10-09 17:08:21 +0000
@@ -221,7 +221,11 @@
 # choke on a Unicode string containing a relative path if
 # os.getcwd() returns a non-sys.getdefaultencoding()-encoded
 # string.
-_fs_enc = sys.getfilesystemencoding()
+
+# Default to 'ascii' on systems that don't return file system
+# encoding. Python 2.4.3 on FreeBSD 4.11 is a known
+# example. _posix_realpath breaks if _fs_enc is empty.
+_fs_enc = sys.getfilesystemencoding() or 'ascii'
 def _posix_abspath(path):
     # jam 20060426 rather than encoding to fsencoding
     # copy posixpath.abspath, but use os.getcwdu instead






More information about the bazaar mailing list