New submission from David Powell <[email protected]>:
The problem is easy to reproduce:
>>> import xdrlib
>>> p = xdrlib.Packer()
>>> p.pack_int(-1)
__main__:1: DeprecationWarning: struct integer overflow masking is deprecated
The cause is xdrlib.Packer uses the same pack operation for both
signed and unsigned integers...
def pack_uint(self, x):
self.__buf.write(struct.pack('>L', x))
pack_int = pack_uint
...and the unsigned struct.pack('>L', x) gags on the negative value.
----------
components: Extension Modules
messages: 115034
nosy: dep
priority: normal
severity: normal
status: open
title: xdrlib's pack_int generates DeprecationWarnings for negative in-range
values
type: behavior
versions: Python 2.6
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue9696>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com