summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Misc/NEWS4
-rw-r--r--Modules/posixmodule.c2
2 files changed, 5 insertions, 1 deletions
diff --git a/Misc/NEWS b/Misc/NEWS
index 8495448a9f..5f3347910e 100644
--- 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.
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
index 3892a91f01..527c92a62d 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