[issue8161] inconsistency behavior in ctypes.c_char_p dereferencing

Jackson Yang report at bugs.python.org
Wed Mar 17 10:09:47 CET 2010


New submission from Jackson Yang <jackson.yang at augmentum.com>:

# Python 3.1.2rc1 (r312rc1:78742, Mar  7 2010, 07:49:40)
# [MSC v.1500 32 bit (Intel)] on win32
import ctypes

class T(ctypes.Structure):
	_fields_ = (
		('member', ctypes.c_char * 16),
	)

# dereference a c_char_Array variable would return <bytes>
print('%r'%((ctypes.c_char * 16)()[:]))
# dereference from a c_char_Array member would return <str>, which is buggy
print('%r'%(T().member[:]))

----------
assignee: theller
components: ctypes
messages: 101214
nosy: nullnil, theller
severity: normal
status: open
title: inconsistency behavior in ctypes.c_char_p dereferencing
type: behavior
versions: Python 3.2

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


More information about the Python-bugs-list mailing list