]> granicus.if.org Git - python/commitdiff
Issue #2173: fix build failure on OS X. device_encoding was returning an
authorMark Dickinson <dickinsm@gmail.com>
Thu, 11 Dec 2008 18:03:03 +0000 (18:03 +0000)
committerMark Dickinson <dickinsm@gmail.com>
Thu, 11 Dec 2008 18:03:03 +0000 (18:03 +0000)
empty string, causing an (invisible) LookupError on any attempt to write
to sys.stdout.

Misc/NEWS
Modules/posixmodule.c

index 8495448a9f2a0f28df6ab9d7d15ad7145b645601..5f3347910e7b24bc2177b345d955c0328bb2c657 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -12,6 +12,10 @@ What's New in Python 3.1 alpha 0
 Core and Builtins
 -----------------
 
+- Issue #2173: When getting device encoding, check that return value of
+  nl_langinfo is not the empty string.  This was causing silent build
+  failures on OS X.
+
 - Issue #4597: Fixed several opcodes that weren't always propagating
   exceptions.
 
index 3892a91f01bf1da663f4b6f7dc67aa1102941a07..527c92a62d93160cfb310cd49df93acc65dd7b44 100644 (file)
@@ -6724,7 +6724,7 @@ device_encoding(PyObject *self, PyObject *args)
 #elif defined(CODESET)
        {
                char *codeset = nl_langinfo(CODESET);
-               if (codeset)
+               if (codeset != NULL && codeset[0] != 0)
                        return PyUnicode_FromString(codeset);
        }
 #endif