cpython (merge 3.2 -> default): - Issue #13840: Fix ctypes.create_string_buffer exception message and docs.
http://hg.python.org/cpython/rev/52f68c95e025 changeset: 74633:52f68c95e025 parent: 74631:93075fb1360a parent: 74632:be9d02536a81 user: Meador Inge <meadori@gmail.com> date: Thu Jan 26 08:47:27 2012 -0600 summary: - Issue #13840: Fix ctypes.create_string_buffer exception message and docs. files: Doc/library/ctypes.rst | 4 ---- Misc/NEWS | 3 +++ Modules/_ctypes/_ctypes.c | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/Doc/library/ctypes.rst b/Doc/library/ctypes.rst --- a/Doc/library/ctypes.rst +++ b/Doc/library/ctypes.rst @@ -1823,8 +1823,6 @@ termination character. An integer can be passed as second argument which allows to specify the size of the array if the length of the bytes should not be used. - If the first parameter is a string, it is converted into a bytes object - according to ctypes conversion rules. .. function:: create_unicode_buffer(init_or_size, size=None) @@ -1841,8 +1839,6 @@ allows to specify the size of the array if the length of the string should not be used. - If the first parameter is a bytes object, it is converted into an unicode string - according to ctypes conversion rules. .. function:: DllCanUnloadNow() diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -1837,6 +1837,9 @@ Extension Modules ----------------- +- Issue #13840: The error message produced by ctypes.create_string_buffer + when given a Unicode string has been fixed. + - Issue #9975: socket: Fix incorrect use of flowinfo and scope_id. Patch by Vilmos Nebehaj. diff --git a/Modules/_ctypes/_ctypes.c b/Modules/_ctypes/_ctypes.c --- a/Modules/_ctypes/_ctypes.c +++ b/Modules/_ctypes/_ctypes.c @@ -1096,7 +1096,7 @@ if (!PyBytes_Check(value)) { PyErr_Format(PyExc_TypeError, - "str/bytes expected instead of %s instance", + "bytes expected instead of %s instance", Py_TYPE(value)->tp_name); return -1; } else -- Repository URL: http://hg.python.org/cpython
participants (1)
-
meador.inge