#31 Class methods can't be called (6.1.1 and Python 2.6.2)

open
nobody
None
5
2009-10-06
2009-10-06
Anonymous
No

Hi!
I created my own class with parent class Py::PythonExtension and declared a function with no arguments. I couldn't call it from python code and after some debugging I found out that problem is a incompatibility between PyCCX 6.1.1 calling protocol and Python 2.6.2 C API. The method readyType call PyType_Ready function from Python API. The PyType_Ready function fill up tp_getattro and tp_setattro attributes with PyObject_GenericSetAttr function in the class describing table. After that when python code try to get method by name it call function in tp_setattro and get nothing. It doesn't try to look for method by calling tp_getattr.
I found 2 temporary solution for this problem:
1. Set tp_getattro to zero after PyType_Ready call ( In this case python code look for method in tp_getattr )
2. Add getattro support to my class and then call getattr_methods

By the way, many thanx for the beautiful library :)

Discussion