[Python-Dev] int/long FutureWarning (original) (raw)

Mark Hammond mhammond@skippinet.com.au
Thu, 28 Nov 2002 09:48:03 +1100


I figured that once I started pasting and checking code like: """ if sys.version_info >= (2, 3): # sick off the new hex() warnings, and no time to digest what the # impact will be! import warnings warnings.filterwarnings("ignore", category=FutureWarning, append=1) """

into the Mozilla source tree, it was time to start digesting!

Unfortunately, a simple answer seems to allude me whenever it is brought up here.

So, to cut a long story short, I have lots and lots of script generated, then often hand-edited source files with constants defined thus:

SOMETHING = 0x80000000

Which generate a warning telling me that this may become a positive long in Python 2.4. All I really care about is how my C extension code, which does:

PyArg_ParseTuple("ilhH", ...) // Take your pick

is going to react to this change? (There are similar warnings for certain shift operations too, but I believe they will all boil down to the same issue)

People using the win32all extensions are unlikely to be happy with the screenfulls of warning generated. I know I'm not . But I don't know what to do.

I know I can suppress the warning either using the code I have above, or simply by appending an L to each of the thousands of constants, or even converting them all to decimal. But if nothing is going to change from the POV of my C extensions, then changing all these constants just to suppress a warning seems overkill.

Any suggestions for me?

Thanks,

Mark.