C extension tp_getattr slot: structmember interface; new tp_* slots

John Machin sjmachin at --nospam--lexicon.net
Mon Jan 28 17:27:34 EST 2002


"John Machin" <sjmachin at --nospam--lexicon.net> wrote in message
news:3c554b41 at pan.izone.net.au...
[snip]
> PyMemberDef structure, which has an additional item,
> char * doc. This looks promising.
[snip]
> Eureka -- further rummaging in fileobject.c and funcobject.c reveals a
whole
> lot about the tp_methods, tp_members, and tp_getset slots ... looks like
the
> tp_get/setattr slots are now obsolete.

Well, I managed to RTFPEP (#252) before being told to :-)

Also managed to implement the tp_methods and tp_members functionality in a
module (and hidden the tp_gettattr stuff), and it seems to work.

However the PyType_InitDict() that is mentioned in PEPs 252 and 253 seems to
have ended up on the cutting room floor -- I copied from the PyType_Ready()
example in xxsubtype.c, and happiness prevailed.

Can somebody please pronounce on this: Under what circumstances is it
necessary to call PyType_Ready() from the module initialisation code?

TIA,
John





More information about the Python-list mailing list