Roundup Robot devn...@psf.upfronthosting.co.za added the comment:
New changeset be9d02536a81 by Meador Inge in branch '3.2':
- Issue #13840: Fix ctypes.create_string_buffer exception message and docs.
http://hg.python.org/cpython/rev/be9d02536a81
New changeset 52f68c95e025 by Meador Inge in
Meador Inge mead...@gmail.com added the comment:
I just fixed the docs and error message for now. I might revisit the ASCII
decoding later. Thanks for the bug report Vincent.
--
resolution: - fixed
stage: patch review - committed/rejected
status: open - closed
Changes by Meador Inge mead...@gmail.com:
--
nosy: +meador.inge
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13840
___
___
Python-bugs-list
Meador Inge mead...@gmail.com added the comment:
The 'create_unicode_buffer' docs are currently wrong too:
If the first parameter is a bytes object, it is converted into an
unicode string according to ctypes conversion rules.
ctypes.create_unicode_buffer(b'foo')
Traceback (most recent call
Vincent Pelletier plr.vinc...@gmail.com added the comment:
Thanks for the quick reply.
FWIW, in 2.7 doc ctype.create_string_buffer is said to accept unicode objects
as parameter. I don't use this personally, so I don't mind 3.x only working on
bytes - and already fixed my code accordingly.
New submission from Vincent Pelletier plr.vinc...@gmail.com:
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
Georg Brandl ge...@python.org added the comment:
It should only take bytes; str is Unicode in 3.x.
So the docs and the error message are wrong, the behavior is correct.
Reclassifying as a docs issue.
--
assignee: - docs@python
components: +Documentation -ctypes
nosy: +docs@python,