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.

Author vpelletier
Recipients vpelletier
Date 2012-01-23.07:53:06
SpamBayes Score 2.7531491e-06
Marked as misclassified No
Message-id <1327305188.04.0.956774664708.issue13840@psf.upfronthosting.co.za>
In-reply-to
Content
ctypes.create_string_buffer documentation[1] says init_or_size parameter should accept a string. As of 3.2, it raises:
>>> import ctypes
>>> ctypes.create_string_buffer('foo')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3.2/ctypes/__init__.py", line 59, in create_string_buffer
    buf.value = init
TypeError: str/bytes expected instead of str instance

It works fine as of 2.7 (and very probably any 2.x up to ctypes introduction):
>>> import ctypes
>>> ctypes.create_string_buffer('foo')
<ctypes.c_char_Array_4 object at 0x7fbdcb8b95f0>

[1] http://docs.python.org/py3k/library/ctypes.html#ctypes.create_string_buffer

Regards,
Vincent Pelletier
History
Date User Action Args
2012-01-23 07:53:08vpelletiersetrecipients: + vpelletier
2012-01-23 07:53:08vpelletiersetmessageid: <1327305188.04.0.956774664708.issue13840@psf.upfronthosting.co.za>
2012-01-23 07:53:07vpelletierlinkissue13840 messages
2012-01-23 07:53:06vpelletiercreate