[Python-Dev] Bug 216405 (original) (raw)

Thomas Heller thomas.heller@ion-tof.com
Fri, 19 Oct 2001 14:49:40 +0200


I know most of you are busy with the release, but may I beg again that SF bug #216405 be finally fixed in Python 2.2?

I can apply the patch myself, if nobody has time, but I need an OK from Guido ;-) The bug is currently marked closed, resolution is set to 'later'.

http://sourceforge.net/tracker/index.php?func=detail&aid=216405&group_id=5470&atid=105470

I know that the buffer stuff is somewhat (broken|fragile|dangerous, pick your favorite here), but this does at least fix a small point.

Here is the complete patch against the current CVS sources, I've made a build with this patch applied, and the whole test suite runs the same way as it does without this patch (can only test on windows):

147 tests OK. 34 tests skipped: test_al test_bsddb test_cd test_cl test_commands test_crypt test_dbm test_dl test_fcntl test_fork1 test_gdbm test_gl test_grp test_gzip test_imgfile test_largefile test_linuxaudiodev test_mhlib test_minidom test_nis test_openpty test_poll test_pty test_pwd test_pyexpat test_sax test_signal test_socket_ssl test_socketserver test_sunaudiodev test_sundry test_timing test_zipfile test_zlib 8 skips unexpected on win32: test_zipfile test_bsddb test_sax test_sundry test_minidom test_zlib test_pyexpat test_gzip

Thomas

Index: bufferobject.c

RCS file: /cvsroot/python/python/dist/src/Objects/bufferobject.c,v retrieving revision 2.15 diff -c -r2.15 bufferobject.c *** bufferobject.c 2001/08/24 18:34:26 2.15 --- bufferobject.c 2001/10/19 12:46:33


*** 73,83 **** offset = count; if ( offset + size > count ) size = count - offset; ! ! /* if the base object is another buffer, then "deref" it */ ! if ( PyBuffer_Check(base) ) base = ((PyBufferObject *)base)->b_base; ! return _PyBuffer_FromMemory(base, (char *)p + offset, size, readonly); }

--- 73,85 ---- offset = count; if ( offset + size > count ) size = count - offset; !
! /* 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); }