chiark / gitweb /
_u32: Allow LONG_MAX to be stored in a Python int.
[mLib-python] / utils.pyx
index 6b62989ccba1e553fe4ceb2b250a04598b9bf5a2..849effea3f11dbf37963653c369ccb7a9f994b1b 100644 (file)
--- a/utils.pyx
+++ b/utils.pyx
@@ -26,7 +26,7 @@
 # Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
 cdef object _u32(uint32 x):
 # Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
 cdef object _u32(uint32 x):
-  if x < LONG_MAX:
+  if x <= LONG_MAX:
     return PyInt_FromLong(x)
   else:
     return PyLong_FromUnsignedLong(x)
     return PyInt_FromLong(x)
   else:
     return PyLong_FromUnsignedLong(x)