mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
Unsigned 1 and 2 byte sized formats shouldn't result in long integer values!
This commit is contained in:
parent
c94f16f156
commit
39ef2274a3
1 changed files with 8 additions and 2 deletions
|
@ -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 *
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue