msg115034 - (view) |
Author: David Powell (dep) |
Date: 2010-08-26 22:05 |
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. |
|
|
msg115047 - (view) |
Author: Éric Araujo (eric.araujo) *  |
Date: 2010-08-27 00:05 |
Thanks for the report. This actually raises an error with current Pythons: 2.7 traceback: File "xdrlib.py", line 54, in pack_uint self.__buf.write(struct.pack('>L', x)) struct.error: integer out of range for 'L' format code (The 3.x error message is slightly less helpful: “struct.error: argument out of range”). Would you like to make a patch for this? Bug triage tips: 2.6 only gets security fixes, bugs are not fixed there anymore. “Extension modules” are modules written in C, like time; Python modules map to the “Library” component. |
|
|
msg132302 - (view) |
Author: Filip Gruszczyński (gruszczy) |
Date: 2011-03-27 09:59 |
Here is a test and a patch. |
|
|
msg132334 - (view) |
Author: Mark Dickinson (mark.dickinson) *  |
Date: 2011-03-27 15:12 |
Patch looks good to me. Thanks! |
|
|
msg132335 - (view) |
Author: Roundup Robot (python-dev)  |
Date: 2011-03-27 15:15 |
New changeset d3f9a6d7f6e4 by Mark Dickinson in branch '2.7': Issue #9696: Fix exception incorrectly raised by xdrlib.Packer.pack_int when trying to pack a negative (in-range) integer. http://hg.python.org/cpython/rev/d3f9a6d7f6e4 |
|
|
msg132337 - (view) |
Author: Filip Gruszczyński (gruszczy) |
Date: 2011-03-27 15:32 |
I believe this should be applied also against 3.3. I was working on this using 3.3 code base, so it is not working there too. |
|
|
msg132340 - (view) |
Author: Mark Dickinson (mark.dickinson) *  |
Date: 2011-03-27 15:35 |
Patience! I'm getting there... |
|
|
msg132342 - (view) |
Author: Filip Gruszczyński (gruszczy) |
Date: 2011-03-27 15:37 |
I'm sorry, I wasn't hurrying you. Just wanted to make sure you know. |
|
|
msg132344 - (view) |
Author: Roundup Robot (python-dev)  |
Date: 2011-03-27 15:39 |
New changeset bd5e821f201c by Mark Dickinson in branch '3.1': Issue #9696: Fix exception incorrectly raised by xdrlib.Packer.pack_int when trying to pack a negative (in-range) integer. http://hg.python.org/cpython/rev/bd5e821f201c New changeset 391b2ddbc1b7 by Mark Dickinson in branch '3.2': Merge #9696 http://hg.python.org/cpython/rev/391b2ddbc1b7 New changeset d9b64a86d5a7 by Mark Dickinson in branch 'default': Merge #9696 http://hg.python.org/cpython/rev/d9b64a86d5a7 |
|
|
msg132345 - (view) |
Author: Mark Dickinson (mark.dickinson) *  |
Date: 2011-03-27 15:41 |
> I'm sorry, I wasn't hurrying you. Just wanted to make sure you know. No problem :-). Thanks for the fix! |
|
|