[Python-bugs-list] [ python-Bugs-681367 ] C subtypes do not inherit tp_as_buffer

SourceForge.net noreply@sourceforge.net
Tue, 11 Feb 2003 12:48:39 -0800


Bugs item #681367, was opened at 2003-02-05 19:23
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=681367&group_id=5470

Category: Python Interpreter Core
Group: Python 2.3
>Status: Closed
>Resolution: Accepted
Priority: 5
Submitted By: Greg Chapman (glchapman)
Assigned to: Guido van Rossum (gvanrossum)
Summary: C subtypes do not inherit tp_as_buffer

Initial Comment:
Subtypes of str (for example) implemented in C do not 
inherit str's tp_as_buffer funcs unless the subtypes provide 
a pointer to a tp_as_buffer structure in their type struct.  
This is different from how the other method suites 
(tp_as_sequence, etc.) are handled; near the end of 
PyType_Ready the other method suites are copied from 
the base into the subtype if the subtype's slot is NULL.  

It looks like the tp_as_buffer omission is simply an 
oversight, since the flag manipulations in inherit_special 
appear to be preparing the way for copying the base 
pointer into the subtype.  So I've attached a small patch 
(against the 2.3a1 version of typeobject.c) to fix this.


----------------------------------------------------------------------

>Comment By: Guido van Rossum (gvanrossum)
Date: 2003-02-11 15:48

Message:
Logged In: YES 
user_id=6380

Accepted and checked in. I'm not 100% sure, but I can't see
anything wrong with it, so here it goes.

----------------------------------------------------------------------

Comment By: Greg Chapman (glchapman)
Date: 2003-02-05 19:25

Message:
Logged In: YES 
user_id=86307

aargh -- the patch didn't get attached; trying again.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=681367&group_id=5470