473,395 Members | 1,968 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

How to get rid of "hex/oct constants > sys.maxint" warning?

I'm getting tired of seeing meaningless warnings from my code,
but I can't figure out how to get rid of them:

For example:

fcntl.ioctl(fd,0xc0047a80,s) causes

FutureWarning: hex/oct constants > sys.maxint will return
positive values in Python 2.4 and up

Firstly, I have no idea what that error means in this context.
0xc0047a80 isn't intended to be an integer (either positive or
negative): it's just a chunk of 32 bits.

Googling the newsgroup came up with the suggestion that putting
an "L" on the end of the constant would eliminate the warning,
but it causes an error:

fcntl.ioctl(fd,0xc0047a80L,s) causes

OverflowError: long int too large to convert to int

So, that doesn't work.

How _do_ I get rid of the warning? Is there a way to tell
Python that the constant isn't an integer, it's just a bit
pattern?

--
Grant Edwards grante Yow! Mr and Mrs PED, can
at I borrow 26.7
visi.com
Jul 18 '05 #1
3 2266
On 11 Aug 2004, Grant Edwards wrote:
How _do_ I get rid of the warning? Is there a way to tell
Python that the constant isn't an integer, it's just a bit
pattern?


The best way is to tell Python to silence the warning:
0xc0047a80 FutureWarning import warnings
warnings.simplefilter('ignore',FutureWarning)
0xc0047a80

-1073448320

fcntl() doesn't really care what it gets, so long as it can convert it to
a 32-bit value, something it can't do with a long integer. In 2.3,
0xc0047a80 returns a negative integer, which is acceptable to fcntl(). In
2.4, it's going to return a long integer -- presumably fcntl() will also
be able to accept long integers.

Jul 18 '05 #2
Grant Edwards <gr****@visi.com> writes:
I'm getting tired of seeing meaningless warnings from my code,
but I can't figure out how to get rid of them:

For example:

fcntl.ioctl(fd,0xc0047a80,s) causes

FutureWarning: hex/oct constants > sys.maxint will return
positive values in Python 2.4 and up

Firstly, I have no idea what that error means in this context.
0xc0047a80 isn't intended to be an integer (either positive or
negative): it's just a chunk of 32 bits.

Googling the newsgroup came up with the suggestion that putting
an "L" on the end of the constant would eliminate the warning,
but it causes an error:

fcntl.ioctl(fd,0xc0047a80L,s) causes

OverflowError: long int too large to convert to int

So, that doesn't work.

How _do_ I get rid of the warning? Is there a way to tell
Python that the constant isn't an integer, it's just a bit
pattern?


It's horrible, but ~int(~0xc0047a80L&0xFFFFFFFFL) will work.

Cheers,
mwh

--
I love the way Microsoft follows standards. In much the same
manner that fish follow migrating caribou. -- Paul Tomblin
-- http://home.xnet.com/~raven/Sysadmin/ASR.Quotes.html
Jul 18 '05 #3
On 2004-08-11, Christopher T King <sq******@WPI.EDU> wrote:
How _do_ I get rid of the warning? Is there a way to tell
Python that the constant isn't an integer, it's just a bit
pattern?


The best way is to tell Python to silence the warning:
0xc0047a80 FutureWarning import warnings
warnings.simplefilter('ignore',FutureWarning)


Yup, that's what I was looking for. Now that I know how it's
spelled, Google find's plenty of examples. :)
--
Grant Edwards grante Yow! Yow! Am I cleansed
at yet?!
visi.com
Jul 18 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Eric A. Forgy | last post by:
Hello, I am just learning Java and am trying to write a method that does something like //=========================================== public Static List find(double array,double val,String...
2
by: Generic Usenet Account | last post by:
What exactly is the difference between the hex manipulator and the following statement: cout.setf(ios_base::hex)? According to Stroustrup, Third Edition, Section 21.4.4, "once set, a base is...
3
by: Vivek | last post by:
Hi, Can someone give an example of a query which produces the following warning: SQL0012W Correlation without qualification has occurred for the column "<column>".
16
by: Tantale | last post by:
I used this serviec to check my webpage http://www.jmrw.com/Abroad/Barcelone/index.htm Made with Dreamweaver 8. The result is 206 errors, most of them "end tag omitted, but OMITTAG NO was...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.