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/Modules/posixmodule.c b/Modules/posixmodule.c
index 3892a91..527c92a 100644
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -6724,7 +6724,7 @@
 #elif defined(CODESET)
 	{
 		char *codeset = nl_langinfo(CODESET);
-		if (codeset)
+		if (codeset != NULL && codeset[0] != 0)
 			return PyUnicode_FromString(codeset);
 	}
 #endif