summaryrefslogtreecommitdiffstats
path: root/Modules/_testbuffer.c
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2012-09-29 07:27:15 (GMT)
committerGeorg Brandl <georg@python.org>2012-09-29 07:27:15 (GMT)
commit99a247fd01c1cd780c0c3ee1116657627f1ee744 (patch)
tree319e33cb6612c3fafb2eb82e15c5e85e3d771e4f /Modules/_testbuffer.c
parent1628eaa5dc8892ff381ca7558cc7c8d80fac494d (diff)
parent8ed677db129171317b8ee7cd45b39b9013f5a2d6 (diff)
downloadcpython-99a247fd01c1cd780c0c3ee1116657627f1ee744.zip
cpython-99a247fd01c1cd780c0c3ee1116657627f1ee744.tar.gz
cpython-99a247fd01c1cd780c0c3ee1116657627f1ee744.tar.bz2
Merge with main repo default branch.
Diffstat (limited to 'Modules/_testbuffer.c')
-rw-r--r--Modules/_testbuffer.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/Modules/_testbuffer.c b/Modules/_testbuffer.c
index 87ada0a..316666e 100644
--- a/Modules/_testbuffer.c
+++ b/Modules/_testbuffer.c
@@ -16,6 +16,7 @@ PyObject *calcsize = NULL;
static const char *simple_fmt = "B";
PyObject *simple_format = NULL;
#define SIMPLE_FORMAT(fmt) (fmt == NULL || strcmp(fmt, "B") == 0)
+#define FIX_FORMAT(fmt) (fmt == NULL ? "B" : fmt)
/**************************************************************************/
@@ -513,10 +514,8 @@ static int
cmp_structure(Py_buffer *dest, Py_buffer *src)
{
Py_ssize_t i;
- int same_fmt = ((dest->format == NULL && src->format == NULL) || \
- (strcmp(dest->format, src->format) == 0));
- if (!same_fmt ||
+ if (strcmp(FIX_FORMAT(dest->format), FIX_FORMAT(src->format)) != 0 ||
dest->itemsize != src->itemsize ||
dest->ndim != src->ndim)
return -1;