[New-bugs-announce] [issue9696] xdrlib's pack_int generates DeprecationWarnings for negative in-range values
David Powell
report at bugs.python.org
Fri Aug 27 00:05:03 CEST 2010
New submission from David Powell <powelliptic at gmail.com>:
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 <report at bugs.python.org>
<http://bugs.python.org/issue9696>
_______________________________________
More information about the New-bugs-announce
mailing list