[omniORB] Python OverflowError: integer literal too large

Duncan Grisby dgrisby@uk.research.att.com
Fri, 18 May 2001 15:32:01 +0100


On Friday 18 May, "Bray, Carl" wrote:

> IDL can't be imported when using large unsigned longs

[...]
> _0_Test.RESERVED = 4294967264

[...]
> OverflowError: integer literal too large

This bug is due to a change in the way Python 2.x stringifies long
integers. With Python 1.5.2, str(4294967264L) is "4294967264L", but
with 2.x it is "4294967264" without the 'L'. I've checked in a fix to
the IDL compiler back-end. It's not exactly huge, so I've included it
here.

Cheers,

Duncan.


diff -u -r1.27.2.6 python.py
--- src/lib/omniORBpy/omniidl_be/python.py	2001/04/23 13:53:08	1.27.2.6
+++ src/lib/omniORBpy/omniidl_be/python.py	2001/05/18 14:19:23
@@ -1590,6 +1590,10 @@
 
     elif kind == idltype.tk_long and val == -2147483647 - 1:
         return "-2147483647 - 1"
+
+    elif type(val) is type(1L):
+        return repr(val)
+
     else:
         return str(val)
 

-- 
 -- Duncan Grisby  \  Research Engineer  --
  -- AT&T Laboratories Cambridge          --
   -- http://www.uk.research.att.com/~dpg1 --