summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorThomas Heller <theller@ctypes.org>2001-10-19 13:49:35 (GMT)
committerThomas Heller <theller@ctypes.org>2001-10-19 13:49:35 (GMT)
commitfdc1bd305bcf8d6ebefe98313fa6c310623a0cb9 (patch)
treef6833d7e3bf18adba84219857093156da34f2060 /Objects
parentcad8fa15010b22b2802d2bbbddd2ba2fc7b06f57 (diff)
downloadcpython-fdc1bd305bcf8d6ebefe98313fa6c310623a0cb9.zip
cpython-fdc1bd305bcf8d6ebefe98313fa6c310623a0cb9.tar.gz
cpython-fdc1bd305bcf8d6ebefe98313fa6c310623a0cb9.tar.bz2
Fix for Bug #216405:
use the correct base for a buffer object in _PyBuffer_FromObject.
Diffstat (limited to 'Objects')
-rw-r--r--Objects/bufferobject.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/Objects/bufferobject.c b/Objects/bufferobject.c
index 242261f..57d031c 100644
--- a/Objects/bufferobject.c
+++ b/Objects/bufferobject.c
@@ -73,11 +73,13 @@ _PyBuffer_FromObject(PyObject *base, int offset, int size,
offset = count;
if ( offset + size > count )
size = count - offset;
-
- /* if the base object is another buffer, then "deref" it */
- if ( PyBuffer_Check(base) )
+
+ /* if the base object is another buffer, then "deref" it,
+ * except if the base of the other buffer is NULL
+ */
+ if ( PyBuffer_Check(base) && (((PyBufferObject *)base)->b_base) )
base = ((PyBufferObject *)base)->b_base;
-
+
return _PyBuffer_FromMemory(base, (char *)p + offset, size, readonly);
}