[issue28215] PyModule_AddIntConstant() wraps >=2^32 values when long is 4 bytes

2016-09-20 Thread Christian Heimes
Christian Heimes added the comment: Oh sorry, I missed the point that you are talking about an existing constant in the socket module. At first I thought that you were referring to a constant that you have added. It sounds like a bug for constants >= 2**31. -- nosy: +haypo

[issue28215] PyModule_AddIntConstant() wraps >=2^32 values when long is 4 bytes

2016-09-20 Thread Christian Heimes
Christian Heimes added the comment: The constant is an unsigned long but PyModule_AddIntConstant() takes a signed long. You have to write your own function that uses PyLong_FromUnsignedLong() and PyModule_AddObject(). Do you get a compiler warning because 0x8000U is larger than (1<<31)-1?

[issue28215] PyModule_AddIntConstant() wraps >=2^32 values when long is 4 bytes

2016-09-20 Thread Kyle Altendorf
New submission from Kyle Altendorf: I am cross compiling Python 3.5.2 for use on a 32-bit ARM processor with Linux. I use socket.CAN_EFF_FLAG and noticed that it is negative on the target despite being positive on my host (64-bit Intel Linux). Host: altendky@tp:~$ uname -a Linux tp