This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: C subtypes do not inherit tp_as_buffer
Type: Stage:
Components: Interpreter Core Versions: Python 2.3
process
Status: closed Resolution: accepted
Dependencies: Superseder:
Assigned To: gvanrossum Nosy List: glchapman, gvanrossum
Priority: normal Keywords:

Created on 2003-02-06 00:23 by glchapman, last changed 2022-04-10 16:06 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
typeobject.c.diff glchapman, 2003-02-06 00:25
Messages (3)
msg14471 - (view) Author: Greg Chapman (glchapman) Date: 2003-02-06 00:23
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.
msg14472 - (view) Author: Greg Chapman (glchapman) Date: 2003-02-06 00:25
Logged In: YES 
user_id=86307

aargh -- the patch didn't get attached; trying again.
msg14473 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2003-02-11 20:48
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.
History
Date User Action Args
2022-04-10 16:06:34adminsetgithub: 37919
2003-02-06 00:23:39glchapmancreate