Menu

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

None
closed
nobody
None
5
2016-05-10
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

  • Barry Alan Scott

    • status: open --> closed
    • Group: -->
     
  • Barry Alan Scott

    You can call member function now using the callMemberFunction() method.
    Added in release 6.2.0.

     

Log in to post a comment.