[Python-checkins] cpython: Checking if an unsigned long is < 0 is pointless.
brett.cannon
python-checkins at python.org
Tue Jun 7 05:23:13 CEST 2011
http://hg.python.org/cpython/rev/9ef14857e49c
changeset: 70696:9ef14857e49c
user: Brett Cannon <brett at python.org>
date: Mon Jun 06 20:22:56 2011 -0700
summary:
Checking if an unsigned long is < 0 is pointless.
Found by LLVM/clang 2.9.
files:
Modules/mmapmodule.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/Modules/mmapmodule.c b/Modules/mmapmodule.c
--- a/Modules/mmapmodule.c
+++ b/Modules/mmapmodule.c
@@ -645,9 +645,9 @@
return NULL;
} else {
/* bounds check the values */
- if (cnt < 0 || (cnt + dest) < cnt || (cnt + src) < cnt ||
- src < 0 || src > self->size || (src + cnt) > self->size ||
- dest < 0 || dest > self->size || (dest + cnt) > self->size) {
+ if ((cnt + dest) < cnt || (cnt + src) < cnt ||
+ src > self->size || (src + cnt) > self->size ||
+ dest > self->size || (dest + cnt) > self->size) {
PyErr_SetString(PyExc_ValueError,
"source, destination, or count out of range");
return NULL;
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list