Commit 39ef2274 authored by Guido van Rossum's avatar Guido van Rossum

Unsigned 1 and 2 byte sized formats shouldn't result in long integer values!

parent c94f16f1
......@@ -694,7 +694,10 @@ bu_uint(p, f)
do {
x = (x<<8) | (*p++ & 0xFF);
} while (--i > 0);
return PyLong_FromUnsignedLong(x);
if (f->size >= 4)
return PyLong_FromUnsignedLong(x);
else
return PyInt_FromLong((long)x);
}
static PyObject *
......@@ -825,7 +828,10 @@ lu_uint(p, f)
do {
x = (x<<8) | (p[--i] & 0xFF);
} while (i > 0);
return PyLong_FromUnsignedLong(x);
if (f->size >= 4)
return PyLong_FromUnsignedLong(x);
else
return PyInt_FromLong((long)x);
}
static PyObject *
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment