[Python-checkins] CVS: python/dist/src/Objects typeobject.c,2.99,2.100
Tim Peters
tim_one@users.sourceforge.net
Thu, 11 Oct 2001 19:38:27 -0700
Update of /cvsroot/python/python/dist/src/Objects
In directory usw-pr-cvs1:/tmp/cvs-serv9055/python/Objects
Modified Files:
typeobject.c
Log Message:
SF bug [#470040] ParseTuple t# vs subclasses.
inherit_slots(): tp_as_buffer was getting inherited as if it were a
method pointer, rather than a pointer to a vector of method pointers. As
a result, inheriting from a type that implemented buffer methods was
ineffective, leaving all the tp_as_buffer slots NULL in the subclass.
Index: typeobject.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Objects/typeobject.c,v
retrieving revision 2.99
retrieving revision 2.100
diff -C2 -d -r2.99 -r2.100
*** typeobject.c 2001/10/11 18:33:53 2.99
--- typeobject.c 2001/10/12 02:38:24 2.100
***************
*** 1658,1661 ****
--- 1658,1662 ----
#define COPYSEQ(SLOT) COPYSLOT(tp_as_sequence->SLOT)
#define COPYMAP(SLOT) COPYSLOT(tp_as_mapping->SLOT)
+ #define COPYBUF(SLOT) COPYSLOT(tp_as_buffer->SLOT)
/* This won't inherit indirect slots (from tp_as_number etc.)
***************
*** 1733,1736 ****
--- 1734,1747 ----
}
+ if (type->tp_as_buffer != NULL && base->tp_as_buffer != NULL) {
+ basebase = base->tp_base;
+ if (basebase->tp_as_buffer == NULL)
+ basebase = NULL;
+ COPYBUF(bf_getreadbuffer);
+ COPYBUF(bf_getwritebuffer);
+ COPYBUF(bf_getsegcount);
+ COPYBUF(bf_getcharbuffer);
+ }
+
basebase = base->tp_base;
***************
*** 1750,1754 ****
COPYSLOT(tp_call);
COPYSLOT(tp_str);
- COPYSLOT(tp_as_buffer);
if (type->tp_flags & base->tp_flags & Py_TPFLAGS_HAVE_RICHCOMPARE) {
if (type->tp_compare == NULL &&
--- 1761,1764 ----