Home Bug Reports

[3.3.1 and 3.4b] slice2py const long problem

HanHan Member Han GenuitOrganization: FOM RijnhuizenProject: Database for Magnum PSI (plasma research).
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

  • mesmes CaliforniaAdministrators, ZeroC Staff Mark SpruiellOrganization: ZeroC, Inc.Project: Ice Developer ZeroC Staff
    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
Sign In or Register to comment.