[Python-3000] Impact of Py_FindMethod removal on external API's

Campbell Barton ideasman42 at gmail.com
Sun Nov 30 07:49:26 CET 2008


Hey there, Recently I started to write a new python/C api for
Blender3D with python3.0rc3.
This PyApi is a thin wrapper for an autogenerated C API to be used by
the UI and animation system  (all in C).

Without going into too many details, Im using tp_getattr so the
requested attribute can be forwarded to our internal functions.
The Blender3D game engine that has used this method to wrap internal
data for some years as well, so I don't think this is that unusual.

We moved most of our api's to use tp_getset, but that only works when
the attributes you need dont change.

Quote...
http://mail.python.org/pipermail/python-3000/2008-July/014303.html
> The primary use of Py_FindMethod was to implement a tp_getattr slot
> handler. Now that it has been removed, there is nothing remaining in
> the py3k codebase that actually uses the tp_getattr slot!

> It has been 12 years since tp_getattro was introduced. Is it time to
> finally phase out tp_getattr?

I have no problems with breaking compatibility for python3000, however
in this case removal of Py_FindMethod, removes functionality for
external C api's that rely on dynamic attributes with tp_getattr.

Is the intention to remove support for tp_getattr altogether?

Note - in the meantime Ill add our own version of Py_FindMethod but
its not ideal.
-- 
- Campbell


More information about the Python-3000 mailing list