Issue #21490: Add new C macros: Py_ABS() and Py_STRINGIFY()

Keep _Py_STRINGIZE() in PC/pyconfig.h to not introduce a dependency between
pyconfig.h and pymacros.h.
This commit is contained in:
Victor Stinner 2014-05-14 17:24:35 +02:00
parent 79b49ab553
commit 45e8e2f218
7 changed files with 60 additions and 59 deletions

View file

@ -48,9 +48,6 @@
*/
#define XSTRINGIZE(v) #v
#define STRINGIZE(v) XSTRINGIZE(v)
#define CHECK_MBUF_RELEASED(mbuf) \
if (((_PyManagedBufferObject *)mbuf)->flags&_Py_MANAGED_BUFFER_RELEASED) { \
PyErr_SetString(PyExc_ValueError, \
@ -660,7 +657,7 @@ mbuf_add_view(_PyManagedBufferObject *mbuf, const Py_buffer *src)
if (src->ndim > PyBUF_MAX_NDIM) {
PyErr_SetString(PyExc_ValueError,
"memoryview: number of dimensions must not exceed "
STRINGIZE(PyBUF_MAX_NDIM));
Py_STRINGIFY(PyBUF_MAX_NDIM));
return NULL;
}
@ -1341,7 +1338,7 @@ memory_cast(PyMemoryViewObject *self, PyObject *args, PyObject *kwds)
if (ndim > PyBUF_MAX_NDIM) {
PyErr_SetString(PyExc_ValueError,
"memoryview: number of dimensions must not exceed "
STRINGIZE(PyBUF_MAX_NDIM));
Py_STRINGIFY(PyBUF_MAX_NDIM));
return NULL;
}
if (self->view.ndim != 1 && ndim != 1) {