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 last):
  File "<stdin>", line 1, in <module>
  File "/home/meadori/src/python/cpython/Lib/ctypes/__init__.py", line 294, in 
create_unicode_buffer
    buf.value = init
TypeError: unicode string expected instead of bytes instance

The attached patch fixes the documentation and exception messages.

Although, it might be more friendly to implement things according to
the current docs (i.e. do the conversions).

----------
components: +ctypes
keywords: +patch
stage:  -> patch review
versions: +Python 3.3
Added file: http://bugs.python.org/file24319/issue13840.patch

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue13840>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to