Retry: Question about FutureWarning

Steven W. Orr steveo at syslang.net
Wed Aug 15 03:44:17 CEST 2007


I'm trying again, since no response indicates that I'm not providing 
enough info.

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. So the idea is that in total we have 4 files called M1.py M2.py M3.py 
and M4.py

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

I need to compile the python modules as part of the package building 
process.

The shell compile command I use to generate both the .pyc and the .pyo 
files 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 both being 
imported into M1

I was able to shut off the warning by adding the following lines *before*
the import of M2 and M3 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 where the reference exists to 0xFFFFFFFF ?

I'm just leary of fixing warnings by looking for ways to shut them off.

Also, do I need to supply any more information?

Thanks for your patience.

--
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