[Python-checkins] CVS: python/dist/src/Objects bufferobject.c,2.15,2.16

Thomas Heller theller@users.sourceforge.net
2001年10月19日 06:49:38 -0700


Update of /cvsroot/python/python/dist/src/Objects
In directory usw-pr-cvs1:/tmp/cvs-serv1921
Modified Files:
	bufferobject.c 
Log Message:
Fix for Bug #216405:
use the correct base for a buffer object in _PyBuffer_FromObject.
Index: bufferobject.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Objects/bufferobject.c,v
retrieving revision 2.15
retrieving revision 2.16
diff -C2 -d -r2.15 -r2.16
*** bufferobject.c	2001年08月24日 18:34:26	2.15
--- bufferobject.c	2001年10月19日 13:49:35	2.16
***************
*** 74,82 ****
 	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);
 }
--- 74,84 ----
 	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);
 }

AltStyle によって変換されたページ (->オリジナル) /