deprecated python 2.5

Fredrik Lundh fredrik at pythonware.com
Tue Sep 12 06:48:04 EDT 2006


bussiere maillist wrote:

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

the value doesn't fit in 16 bits.  try masking off the extra bits on the 
way in:

     struct.pack("<H", (~value) & 0xFFFF)

</F>




More information about the Python-list mailing list