Commit 861d09ec authored by Stefan Behnel's avatar Stefan Behnel

avoid using isspace() due to problem on MacOS-X (Mavericks) and because it is locale dependent

parent caa43e47
...@@ -593,8 +593,11 @@ __pyx_buffmt_parse_array(__Pyx_BufFmt_Context* ctx, const char** tsp) ...@@ -593,8 +593,11 @@ __pyx_buffmt_parse_array(__Pyx_BufFmt_Context* ctx, const char** tsp)
/* Parse all numbers in the format string */ /* Parse all numbers in the format string */
while (*ts && *ts != ')') { while (*ts && *ts != ')') {
if (isspace(*ts)) // ignore space characters (not using isspace() due to C/C++ problem on MacOS-X)
continue; switch (*ts) {
case ' ': case '\f': case '\r': case '\n': case '\t': case '\v': continue;
default: break; /* not a 'break' in the loop */
}
number = __Pyx_BufFmt_ExpectNumber(&ts); number = __Pyx_BufFmt_ExpectNumber(&ts);
if (number == -1) return NULL; if (number == -1) return NULL;
......
...@@ -47,10 +47,16 @@ static int __Pyx_Print(PyObject* f, PyObject *arg_tuple, int newline) { ...@@ -47,10 +47,16 @@ static int __Pyx_Print(PyObject* f, PyObject *arg_tuple, int newline) {
if (PyString_Check(v)) { if (PyString_Check(v)) {
char *s = PyString_AsString(v); char *s = PyString_AsString(v);
Py_ssize_t len = PyString_Size(v); Py_ssize_t len = PyString_Size(v);
if (len > 0 && if (len > 0) {
isspace(Py_CHARMASK(s[len-1])) && // append soft-space if necessary (not using isspace() due to C/C++ problem on MacOS-X)
s[len-1] != ' ') switch (s[len-1]) {
PyFile_SoftSpace(f, 0); case ' ': break;
case '\f': case '\r': case '\n': case '\t': case '\v':
PyFile_SoftSpace(f, 0);
break;
default: break;
}
}
} }
} }
if (newline) { if (newline) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment