Archived

This forum has been archived. Please start a new discussion on GitHub.

[3.3.1 and 3.4b] slice2py const long problem

The slice2py generator converts a long constant into a string when the value exceeds integer, where it should become a long.

For instance, creating a test.ice file
module test {
	const long TestLongConst1 = 0x7fffffff; // ((1<<31) - 1)
	const long TestLongConst2 = 0x80000000; // (1<<31)
};
and importing it into Python
import test

print test.TestLongConst1, type(test.TestLongConst1)
print test.TestLongConst2, type(test.TestLongConst2)
produces
2147483647 <type 'int'>
2147483648 <type 'str'>

Comments

  • mes
    mes California
    Hi,

    I think this mapping was originally necessary to work around some platform limitations, but that's no longer the case. We'll fix this for 3.4.

    Thanks,
    Mark