summaryrefslogtreecommitdiffstats
path: root/Objects/unicodeobject.c
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2007-10-08 03:32:34 (GMT)
committerGuido van Rossum <guido@python.org>2007-10-08 03:32:34 (GMT)
commitbe801acbb1add9b6cc159f349dacad460ca5cc84 (patch)
tree597587d2dc189790573d09d1e85537ebe4720eeb /Objects/unicodeobject.c
parentbae07c9baf3e53164de6f85a18ce747a76b9ffde (diff)
downloadcpython-be801acbb1add9b6cc159f349dacad460ca5cc84.zip
cpython-be801acbb1add9b6cc159f349dacad460ca5cc84.tar.gz
cpython-be801acbb1add9b6cc159f349dacad460ca5cc84.tar.bz2
Delete bufferobject.[ch].
This will undoubtedly require Windows build file changes too.
Diffstat (limited to 'Objects/unicodeobject.c')
-rw-r--r--Objects/unicodeobject.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
index ad78492..e622967 100644
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -1051,6 +1051,7 @@ PyObject *PyUnicode_Decode(const char *s,
const char *errors)
{
PyObject *buffer = NULL, *unicode;
+ Py_buffer info;
if (encoding == NULL)
encoding = PyUnicode_GetDefaultEncoding();
@@ -1068,7 +1069,10 @@ PyObject *PyUnicode_Decode(const char *s,
return PyUnicode_DecodeASCII(s, size, errors);
/* Decode via the codec registry */
- buffer = PyBuffer_FromMemory((void *)s, size);
+ buffer = NULL;
+ if (PyBuffer_FillInfo(&info, (void *)s, size, 1, PyBUF_SIMPLE) < 0)
+ goto onError;
+ buffer = PyMemoryView_FromMemory(&info);
if (buffer == NULL)
goto onError;
unicode = PyCodec_Decode(buffer, encoding, errors);