[New-bugs-announce] [issue19985] Not so correct error message when initializing Struct with ill argument

Vajrasky Kok report at bugs.python.org
Sun Dec 15 10:28:50 CET 2013


New submission from Vajrasky Kok:

Python 3.4 (3.3 is also afflicted:

>>> import struct
>>> struct.Struct(3)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: Struct() argument 1 must be a bytes object, not int
>>> struct.Struct('b')
<Struct object at 0x7fec04763180>

Python 2.7:

>>> import struct
>>> struct.Struct(3)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: Struct() argument 1 must be string, not int
>>> struct.Struct(u'b')
<Struct object at 0x17993e8>

Here is the patch to better error message for Python 3.4 and 3.3.

----------
components: Extension Modules
files: better_error_message_struct_python_34_and_33.patch
keywords: patch
messages: 206218
nosy: vajrasky
priority: normal
severity: normal
status: open
title: Not so correct error message when initializing Struct with ill argument
type: behavior
versions: Python 2.7, Python 3.3, Python 3.4
Added file: http://bugs.python.org/file33143/better_error_message_struct_python_34_and_33.patch

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


More information about the New-bugs-announce mailing list