[Python-Dev] Python C API: Problem sending tuple to a method of a python Class (original) (raw)

Stefan Behnel stefan_ml at behnel.de
Tue Jan 10 09:35:44 CET 2012


Hi,

sorry for hooking into this off-topic thread.

Amaury Forgeot d'Arc, 09.01.2012 19:09:

2012/1/9 <pasparis at noos.fr>

I am trying to send a tuple to a method of a python class and I got a Run failed from netbeans compiler when I want to send a tuple to a simple method in a module it works,when I want to send a simple parameter to a method of a clas it works also but not a tuple to a method of a class This mailing list is for the development of python. For development with python, please ask your questions on the comp.lang.python group or the python-list at python.org mailing list. There you will find friendly people willing to help.

It's also worth mentioning the cython-users mailing list here, in case the OP cares about simplifying these kinds of issues from the complexity of C/C++ into Python. Cython is a really good and simple way to implement these kinds of language interactions, also for embedding Python.

[for your particular question: keep in mind that PyObjectCall takes arguments as a tuple; if you want to pass one tuple, you need to build a 1-tuple around your tuple]

The presented code also requires a whole lot of fixes (specifically in the error handling parts) that Cython would basically just handle for you already.

Stefan



More information about the Python-Dev mailing list