summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBob Ippolito <bob@redivi.com>2006-05-26 16:23:28 (GMT)
committerBob Ippolito <bob@redivi.com>2006-05-26 16:23:28 (GMT)
commit0cbf2c57852d64855b88305dfa7d77f84936a674 (patch)
tree0c6a99470c6bf1d00f5085080ba9518539e77562
parent725fe4089d74f208bb820b967fd54cd982d1a26b (diff)
downloadcpython-0cbf2c57852d64855b88305dfa7d77f84936a674.zip
cpython-0cbf2c57852d64855b88305dfa7d77f84936a674.tar.gz
cpython-0cbf2c57852d64855b88305dfa7d77f84936a674.tar.bz2
fix signed/unsigned mismatch in struct
-rw-r--r--Modules/_struct.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/Modules/_struct.c b/Modules/_struct.c
index 95b5e0b..a114216 100644
--- a/Modules/_struct.c
+++ b/Modules/_struct.c
@@ -763,7 +763,7 @@ bp_uint(char *p, PyObject *v, const formatdef *f)
return -1;
i = f->size;
#ifdef PY_STRUCT_RANGE_CHECKING
- if (i != SIZEOF_LONG && x >= (1 << (i * 8)))
+ if (i != SIZEOF_LONG && x >= (1 << (((unsigned int)i) * 8)))
return _range_error(f->format, f->size, 1);
#endif
do {
@@ -975,7 +975,7 @@ lp_uint(char *p, PyObject *v, const formatdef *f)
return -1;
i = f->size;
#ifdef PY_STRUCT_RANGE_CHECKING
- if (i != SIZEOF_LONG && x >= (1 << (i * 8)))
+ if (i != SIZEOF_LONG && x >= (1 << (((unsigned int)i) * 8)))
return _range_error(f->format, f->size, 1);
#endif
do {