This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Incorrect error message for conflicting initializers of ctypes structure
Type: behavior Stage: resolved
Components: ctypes, Library (Lib) Versions: Python 3.6, Python 3.5
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: amaury.forgeotdarc, belopolsky, meador.inge, python-dev, serhiy.storchaka
Priority: normal Keywords: patch

Created on 2016-06-17 08:35 by serhiy.storchaka, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
ctypes_conflictin_initializers_error_message.patch serhiy.storchaka, 2016-06-17 10:24
Messages (2)
msg268713 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2016-06-17 08:35
>>> 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.
msg268772 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2016-06-18 06:59
New changeset ed81fc7e285b by Serhiy Storchaka in branch '3.5':
Issue #27343: Fixed error message for conflicting initializers of ctypes.Structure.
https://hg.python.org/cpython/rev/ed81fc7e285b

New changeset 40e3790c2a00 by Serhiy Storchaka in branch 'default':
Issue #27343: Fixed error message for conflicting initializers of ctypes.Structure.
https://hg.python.org/cpython/rev/40e3790c2a00
History
Date User Action Args
2022-04-11 14:58:32adminsetgithub: 71530
2016-06-18 07:00:07serhiy.storchakasetstatus: open -> closed
resolution: fixed
stage: commit review -> resolved
2016-06-18 06:59:20python-devsetnosy: + python-dev
messages: + msg268772
2016-06-17 10:24:52serhiy.storchakasetfiles: + ctypes_conflictin_initializers_error_message.patch
2016-06-17 10:23:33serhiy.storchakasetfiles: - ctypes_conflictin_initializers_error_message.patch
2016-06-17 09:26:16berker.peksagsetstage: patch review -> commit review
2016-06-17 08:35:06serhiy.storchakacreate