473,803 Members | 3,422 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2283
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.simple filter('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.co m> 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(~0xc0047a8 0L&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.E DU> 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.simple filter('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
2801
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 relationalOp) { List list = new ArrayList();
2
8870
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 used until reset". For some reason, I interpreted this to mean that "<< hex" manipulator would cause the base to be set for only the current statement, while the cout.setf(ios_base::hex) statement would cause the base to be set for multiple...
3
10409
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
4482
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 specified.". I don't understand this result. Should I modify something ? Thanks
0
9703
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10550
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10295
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7604
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6844
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5501
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5633
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4275
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3799
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.