Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit da2706b

Browse files
committed
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.
1 parent b99d1cd commit da2706b

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

Misc/NEWS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ What's New in Python 3.1 alpha 0
1212
Core and Builtins
1313
-----------------
1414

15+
- Issue #2173: When getting device encoding, check that return value of
16+
nl_langinfo is not the empty string. This was causing silent build
17+
failures on OS X.
18+
1519
- Issue #4597: Fixed several opcodes that weren't always propagating
1620
exceptions.
1721

Modules/posixmodule.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6724,7 +6724,7 @@ device_encoding(PyObject *self, PyObject *args)
67246724
#elif defined(CODESET)
67256725
{
67266726
char *codeset = nl_langinfo(CODESET);
6727-
if (codeset)
6727+
if (codeset != NULL && codeset[0] != 0)
67286728
return PyUnicode_FromString(codeset);
67296729
}
67306730
#endif

0 commit comments

Comments
 (0)