Question about FutureWarning

Steven W. Orr steveo at syslang.net
Tue Aug 14 16:24:31 CEST 2007


I have module M1 which has the following line in it:

   StartTime   = safe_dict_get ( dic, 'starttime', 0xFFFFFFFF )

It gets imported by modules M2 and M3. And finally, M4 imports both M2 and 
M3.

M4
  |\M3
  | |\M1
  |\M2
  | |\M1

I'm building a .deb file which means I have to compile the modules into 
.pyc and .pyo files.

The compile command I use is

python=/usr/bin/python2.3
i_python ()
{
     $python -c "import $1"
     $python -O -c "import $1"
}
i_python M1
i_python M2
i_python M3
i_python M4

When M1 is compiled, there's no problem. The same for when I compile M2 
and M3. But when M4 is compiled, I get the following message:

M1.py:268: FutureWarning: hex/oct constants > sys.maxint will 
return positive values in Python 2.4 and up
   StartTime   = safe_dict_get ( dic, 'starttime', 0xFFFFFFFF )

I get the message twice, ostensibly because of M3 and M2.

I was able to shut off the warning by adding the following lines *before* 
the import in M4.

import warnings
warnings.filterwarnings('ignore', category=FutureWarning)

My question is this: Why can the warning not be shut off by putting the 
two lines in M1?

TIA

-- 
Time flies like the wind. Fruit flies like a banana. Stranger things have  .0.
happened but none stranger than this. Does your driver's license say Organ ..0
Donor?Black holes are where God divided by zero. Listen to me! We are all- 000
individuals! What if this weren't a hypothetical question?
steveo at syslang.net



More information about the Python-list mailing list