[New-bugs-announce] [issue27343] Incorrect error message for conflicting initializers of ctypes structure

Serhiy Storchaka report at bugs.python.org
Fri Jun 17 04:35:06 EDT 2016


New submission from Serhiy Storchaka:

>>> from ctypes import *
>>> class POINT(Structure):
...     _fields_ = [("x", c_int), ("y", c_int)]
... 
>>> POINT(2, 3, x=4)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: duplicate values for field '???'

The name of conflicting field is not output correctly because it is expected to be bytes.

Proposed patch makes the error message always contain the name of conflicting field.

----------
components: Library (Lib), ctypes
files: ctypes_conflictin_initializers_error_message.patch
keywords: patch
messages: 268713
nosy: amaury.forgeotdarc, belopolsky, meador.inge, serhiy.storchaka
priority: normal
severity: normal
stage: patch review
status: open
title: Incorrect error message for conflicting initializers of ctypes structure
type: behavior
versions: Python 3.5, Python 3.6
Added file: http://bugs.python.org/file43430/ctypes_conflictin_initializers_error_message.patch

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


More information about the New-bugs-announce mailing list