deprecated python 2.5

B

bussiere maillist

DeprecationWarning: struct integer overflow masking is deprecated
return struct.pack('>H', ~value)
i didn't understand if someone have some explanation
and what uses instead.
 
J

John Machin

bussiere said:
DeprecationWarning: struct integer overflow masking is deprecated
return struct.pack('>H', ~value)
i didn't understand if someone have some explanation
and what uses instead.

Which 2.5 are you using? Mine (2.5c1, win32) gives me *TWO* messages,
the second of which hints at the obvious remedy:

| DOS prompt>\python25\python
| Python 2.5c1 (r25c1:51305, Aug 17 2006, 10:41:11) [MSC v.1310 32 bit
(Intel)] on
| win32
| Type "help", "copyright", "credits" or "license" for more
information.
| >>> import struct
| >>> struct.pack('>H', 1)
| '\x00\x01'
| >>> struct.pack('>H', ~1)
| __main__:1: DeprecationWarning: struct integer overflow masking is
deprecated
| __main__:1: DeprecationWarning: 'H' format requires 0 <= number <=
65535
| '\xff\xfe'
| >>> ^Z
|
| DOS prompt>\python25\python
| Python 2.5c1 (r25c1:51305, Aug 17 2006, 10:41:11) [MSC v.1310 32 bit
(Intel)] on
| win32
| Type "help", "copyright", "credits" or "license" for more
information.
| >>> import struct
| >>> struct.pack('>H', (~1) & 0xffff)
| '\xff\xfe'
| >>>

HTH,
John
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,787
Messages
2,569,632
Members
45,340
Latest member
Thalia56P0

Latest Threads

Top