[New-bugs-announce] [issue5198] Strange DeprecationWarning behaviour in module struct

Hagen Fürstenau report at bugs.python.org
Tue Feb 10 08:14:48 CET 2009


New submission from Hagen Fürstenau <hfuerstenau at gmx.net>:

struct.pack seems to raise a DeprecationWarning for some structure
formats, but not for others:

Python 2.6.1 (r261:67515, Dec  5 2008, 07:40:41) 
[GCC 4.3.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import struct
>>> struct.pack(">H", 1.0)
sys:1: DeprecationWarning: integer argument expected, got float
'\x00\x01'
>>> struct.pack("H", 1.0)
'\x01\x00'


In addition the DeprecationWarning message gives a strange location for
the problem. With the attached struct_warning.py it locates the problem
at the function call foo() instead of the problematic call of struct.pack:

$ python2.6 struct_warning.py 
struct_warning.py:6: DeprecationWarning: integer argument expected, got
float
  foo()

----------
components: Library (Lib)
files: struct_warning.py
messages: 81532
nosy: hagen
severity: normal
status: open
title: Strange DeprecationWarning behaviour in module struct
type: behavior
versions: Python 2.6, Python 3.0
Added file: http://bugs.python.org/file13007/struct_warning.py

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue5198>
_______________________________________


More information about the New-bugs-announce mailing list