[New-bugs-announce] [issue14563] Segmentation fault on ctypes.Structure subclass with byte string field names

aliles report at bugs.python.org
Thu Apr 12 15:11:02 CEST 2012


New submission from aliles <aaron.iles at gmail.com>:

Python 3.2 will exit with a segmentation fault if a byte string is used as a field name in a subclass of ctypes.Structure.

Python 3.2.2 (default, Dec 18 2011, 18:56:20) 
[GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.1.00)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import ctypes
>>> class Point(ctypes.Structure):
...     _fields_ = ((b'x', ctypes.c_int), (b'y', ctypes.c_int))
... 
Segmentation fault: 11

This also occurs if None or an int is used as the field name.

I would expect that a TypeError exception would be raised if an attempt is made to use an invalid type for the field name.

----------
components: ctypes
files: segfault.py
messages: 158127
nosy: aliles
priority: normal
severity: normal
status: open
title: Segmentation fault on ctypes.Structure subclass with byte string field names
type: crash
versions: Python 3.2
Added file: http://bugs.python.org/file25189/segfault.py

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


More information about the New-bugs-announce mailing list