From: Mark Dickinson Date: Thu, 11 Dec 2008 18:04:15 +0000 (+0000) Subject: Merged revisions 67703 via svnmerge from X-Git-Tag: v3.0.1~244 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0870fb564b48b2cff6e9b6e48d791ca73bf5d968;p=thirdparty%2FPython%2Fcpython.git Merged revisions 67703 via svnmerge from svn+ssh://pythondev@svn.python.org/python/branches/py3k ........ r67703 | mark.dickinson | 2008-12-11 18:03:03 +0000 (Thu, 11 Dec 2008) | 4 lines Issue #2173: fix build failure on OS X. device_encoding was returning an empty string, causing an (invisible) LookupError on any attempt to write to sys.stdout. ........ --- diff --git a/Misc/NEWS b/Misc/NEWS index afb14f957f90..1e91a57cb48a 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -12,6 +12,10 @@ What's New in Python 3.0.1? 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. diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c index 3892a91f01bf..527c92a62d93 100644 --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -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