Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Gwenaël Samain
cython
Commits
fca2e075
Commit
fca2e075
authored
Jun 15, 2011
by
Lisandro Dalcin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use PY_FORMAT_SIZE_T in PyErr_Format() calls
parent
283fbb05
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
14 additions
and
37 deletions
+14
-37
Cython/Compiler/Buffer.py
Cython/Compiler/Buffer.py
+3
-4
Cython/Compiler/ExprNodes.py
Cython/Compiler/ExprNodes.py
+3
-11
Cython/Compiler/Nodes.py
Cython/Compiler/Nodes.py
+4
-8
Cython/Compiler/PyrexTypes.py
Cython/Compiler/PyrexTypes.py
+4
-14
No files found.
Cython/Compiler/Buffer.py
View file @
fca2e075
...
...
@@ -968,8 +968,8 @@ 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",
(Py_ssize_t)ctx->fmt_offset, (Py_ssize_t)offset);
"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;
}
...
...
@@ -1161,8 +1161,7 @@ static CYTHON_INLINE int __Pyx_GetBufferAndValidate(Py_buffer* buf, PyObject* ob
PyErr_Format(PyExc_ValueError,
"Item size of buffer (%"PY_FORMAT_SIZE_T"d byte%s) does not match size of '%s' (%"PY_FORMAT_SIZE_T"d byte%s)",
buf->itemsize, (buf->itemsize > 1) ? "s" : "",
dtype->name,
(Py_ssize_t)dtype->size, (dtype->size > 1) ? "s" : "");
dtype->name, (Py_ssize_t)dtype->size, (dtype->size > 1) ? "s" : "");
goto fail;
}
if (buf->suboffsets == NULL) buf->suboffsets = __Pyx_minusones;
...
...
Cython/Compiler/ExprNodes.py
View file @
fca2e075
...
...
@@ -8506,11 +8506,7 @@ static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);
impl
=
'''
static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
PyErr_Format(PyExc_ValueError,
#if PY_VERSION_HEX < 0x02050000
"too many values to unpack (expected %d)", (int)expected);
#else
"too many values to unpack (expected %zd)", expected);
#endif
"too many values to unpack (expected %"PY_FORMAT_SIZE_T"d)", expected);
}
'''
)
...
...
@@ -8521,12 +8517,8 @@ static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);
impl
=
'''
static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
PyErr_Format(PyExc_ValueError,
#if PY_VERSION_HEX < 0x02050000
"need more than %d value%s to unpack", (int)index,
#else
"need more than %zd value%s to unpack", index,
#endif
(index == 1) ? "" : "s");
"need more than %"PY_FORMAT_SIZE_T"d value%s to unpack",
index, (index == 1) ? "" : "s");
}
'''
)
...
...
Cython/Compiler/Nodes.py
View file @
fca2e075
...
...
@@ -6936,7 +6936,7 @@ static void __Pyx_RaiseArgtupleInvalid(
Py_ssize_t num_found)
{
Py_ssize_t num_expected;
const char *
number, *
more_or_less;
const char *more_or_less;
if (num_found < num_min) {
num_expected = num_min;
...
...
@@ -6948,14 +6948,10 @@ static void __Pyx_RaiseArgtupleInvalid(
if (exact) {
more_or_less = "exactly";
}
number = (num_expected == 1) ? "" : "s";
PyErr_Format(PyExc_TypeError,
#if PY_VERSION_HEX < 0x02050000
"%s() takes %s %d positional argument%s (%d given)",
#else
"%s() takes %s %zd positional argument%s (%zd given)",
#endif
func_name, more_or_less, num_expected, number, num_found);
"%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);
}
"""
)
...
...
Cython/Compiler/PyrexTypes.py
View file @
fca2e075
...
...
@@ -997,13 +997,8 @@ static CYTHON_INLINE Py_UCS4 __Pyx_PyObject_AsPy_UCS4(PyObject* x) {
}
#endif
PyErr_Format(PyExc_ValueError,
"only single character unicode strings can be converted to Py_UCS4, got length "
#if PY_VERSION_HEX < 0x02050000
"%d",
#else
"%zd",
#endif
PyUnicode_GET_SIZE(x));
"only single character unicode strings can be converted to Py_UCS4, "
"got length %"PY_FORMAT_SIZE_T"d", PyUnicode_GET_SIZE(x));
return (Py_UCS4)-1;
}
ival = __Pyx_PyInt_AsLong(x);
...
...
@@ -1053,13 +1048,8 @@ static CYTHON_INLINE Py_UNICODE __Pyx_PyObject_AsPy_UNICODE(PyObject* x) {
if (PyUnicode_Check(x)) {
if (unlikely(PyUnicode_GET_SIZE(x) != 1)) {
PyErr_Format(PyExc_ValueError,
"only single character unicode strings can be converted to Py_UNICODE, got length "
#if PY_VERSION_HEX < 0x02050000
"%d",
#else
"%zd",
#endif
PyUnicode_GET_SIZE(x));
"only single character unicode strings can be converted to Py_UNICODE, "
"got length %"PY_FORMAT_SIZE_T"d", PyUnicode_GET_SIZE(x));
return (Py_UNICODE)-1;
}
return PyUnicode_AS_UNICODE(x)[0];
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment