Skip to content

Commit

Permalink
Fix compile error with gcc 4.7 and using c++11
Browse files Browse the repository at this point in the history
For the new c++ standard a space between simple string concatenation
is mandatory, otherwise it's interpreted as operator"".
  • Loading branch information
rp- committed Apr 5, 2012
1 parent 3905536 commit 4a4d5d9
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Cython/Compiler/ExprNodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -3368,7 +3368,7 @@ def generate_slice_guard_code(self, code, target_size):
check = stop
if check:
code.putln("if (unlikely((%s) != %d)) {" % (check, target_size))
code.putln('PyErr_Format(PyExc_ValueError, "Assignment to slice of wrong length, expected %%"PY_FORMAT_SIZE_T"d, got %%"PY_FORMAT_SIZE_T"d", (Py_ssize_t)%d, (Py_ssize_t)(%s));' % (
code.putln('PyErr_Format(PyExc_ValueError, "Assignment to slice of wrong length, expected %%" PY_FORMAT_SIZE_T "d, got %%" PY_FORMAT_SIZE_T "d", (Py_ssize_t)%d, (Py_ssize_t)(%s));' % (
target_size, check))
code.putln(code.error_goto(self.pos))
code.putln("}")
Expand Down
4 changes: 2 additions & 2 deletions Cython/Compiler/PyrexTypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -1534,7 +1534,7 @@ def sign_and_name(self):
#endif
PyErr_Format(PyExc_ValueError,
"only single character unicode strings can be converted to Py_UCS4, "
"got length %"PY_FORMAT_SIZE_T"d", length);
"got length %" PY_FORMAT_SIZE_T "d", length);
return (Py_UCS4)-1;
}
ival = __Pyx_PyInt_AsLong(x);
Expand Down Expand Up @@ -1589,7 +1589,7 @@ def sign_and_name(self):
if (unlikely(__Pyx_PyUnicode_GET_LENGTH(x) != 1)) {
PyErr_Format(PyExc_ValueError,
"only single character unicode strings can be converted to Py_UNICODE, "
"got length %"PY_FORMAT_SIZE_T"d", __Pyx_PyUnicode_GET_LENGTH(x));
"got length %" PY_FORMAT_SIZE_T "d", __Pyx_PyUnicode_GET_LENGTH(x));
return (Py_UNICODE)-1;
}
#ifdef CYTHON_PEP393_ENABLED
Expand Down
2 changes: 1 addition & 1 deletion Cython/Utility/Buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,7 @@ static int __Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context* ctx) {
offset = ctx->head->parent_offset + field->offset;
if (ctx->fmt_offset != offset) {
PyErr_Format(PyExc_ValueError,
"Buffer dtype mismatch; next field is at offset %"PY_FORMAT_SIZE_T"d but %"PY_FORMAT_SIZE_T"d expected",
"Buffer dtype mismatch; next field is at offset %" PY_FORMAT_SIZE_T "d but %" PY_FORMAT_SIZE_T "d expected",
(Py_ssize_t)ctx->fmt_offset, (Py_ssize_t)offset);
return -1;
}
Expand Down
2 changes: 1 addition & 1 deletion Cython/Utility/FunctionArguments.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ static void __Pyx_RaiseArgtupleInvalid(
more_or_less = "exactly";
}
PyErr_Format(PyExc_TypeError,
"%s() takes %s %"PY_FORMAT_SIZE_T"d positional argument%s (%"PY_FORMAT_SIZE_T"d given)",
"%s() takes %s %" PY_FORMAT_SIZE_T "d positional argument%s (%" PY_FORMAT_SIZE_T "d given)",
func_name, more_or_less, num_expected,
(num_expected == 1) ? "" : "s", num_found);
}
Expand Down
4 changes: 2 additions & 2 deletions Cython/Utility/ObjectHandling.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);

static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
PyErr_Format(PyExc_ValueError,
"too many values to unpack (expected %"PY_FORMAT_SIZE_T"d)", expected);
"too many values to unpack (expected %" PY_FORMAT_SIZE_T "d)", expected);
}

/////////////// RaiseNeedMoreValuesToUnpack.proto ///////////////
Expand All @@ -48,7 +48,7 @@ static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);

static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
PyErr_Format(PyExc_ValueError,
"need more than %"PY_FORMAT_SIZE_T"d value%s to unpack",
"need more than %" PY_FORMAT_SIZE_T "d value%s to unpack",
index, (index == 1) ? "" : "s");
}

Expand Down

2 comments on commit 4a4d5d9

@shawntan
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey!

I've been trying to build a package that requires cython, and I'm running into the same problems.
Have you submitted a pull request to the cython project yet? I'm kinda hoping I don't have to have a patched version of cython in order to run that project. Heh.

@rp-
Copy link
Owner Author

@rp- rp- commented on 4a4d5d9 May 18, 2012

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes it was pulled into master a ?month? ago, but didn't make it into the 0.16 release.

Please sign in to comment.