Using `return_internal_reference` should be invalid for Function

Bug #1366626 reported by Kevin Stenerson
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
PyBindGen
New
Undecided
Unassigned

Bug Description

When using `return_internal_reference` (with a CppClassPtrReturnValue), PyBindGen should throw a CodeGenerationError if the return value is for a module Function (or rather, if it is not for a CppMethod).

Otherwise it will produce C++ output which fails to compile with a more cryptic error message.

Example of GCC error message:

pythonBindings.cpp: In function ‘PyObject* _wrap_mymodule_myfunction(PyObject*, PyObject*, PyObject*)’:
pythonBindings.cpp:4015:23: error: ‘self’ was not declared in this scope
     if (((PyObject *) self) && !PySequence_Contains(wards, ((PyObject *) self)))

As a reduced test case, the following should produce some sort of error:

    from pybindgen.module import Module
    from pybindgen import retval

    mod = Module('mymodule')
    mod.add_class('MyClass')
    mod.add_function('myfunction', retval('mymodule::MyClass *', caller_owns_return = False, return_internal_reference = True), [])

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.