In ReverseWrapperBase, the check to ensure the return value is a tuple fails

Bug #1083957 reported by Max Bélanger
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
PyBindGen
New
Undecided
Unassigned

Bug Description

In pybindgen/typehandlers/base.py, in 'ReverseWrapperBase', the following check is used in 'generate()' to ensure 'py_retval' is a tuple:

## parse the return value
## this ensures that py_retval is always a tuple
self.before_call.write_code('py_retval = Py_BuildValue((char*) "(N)", py_retval);')

However, when my Python function returns a tuple, this check seems to wrap the tuple into another tuple. The following call to 'PyArg_ParseTuple' fails because of this. Removing the call to 'Py_BuildValue' makes it work.

I've patched in the following check to do this only if it's not already a tuple: "if (!PyTuple_Check(py_retval))".
Do you have a better solution to this?

Revision history for this message
Max Bélanger (aeromax) wrote :
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.