std::list< Class const *> generates non-compilable code

Bug #1093504 reported by Mark Browning
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
PyBindGen
New
Undecided
Unassigned

Bug Description

When a container is added for a list of pointers to const objects, the generated code has compilation errors.

The generated method signature is

int _wrap_convert_py2c__CReportSpec_const___star__(PyObject *value, CReportSpec * *address);

It needs to be:

int _wrap_convert_py2c__CReportSpec_const___star__(PyObject *value, CReportSpec const * *address);

The following script will produce this error case in the pybindgen 0.16.0 archive.

from pybindgen import Module, FileCodeSink
import sys

def main():
    out = FileCodeSink(sys.stdout)
    module = Module('acc', cpp_namespace='::')

    module.add_include('"const_test.hpp"')
    module.add_class('CReportSpec', )
    module.add_container('std::list< CReportSpec const * >', 'CReportSpec const *', container_type='list')

    module.generate(out)

if __name__ == '__main__':
    main()

The problem is in that the converter function in pybindgen/converer_functions.py uses the type_traits.ctype_no_modifiers instead of type_traits.ctype. I'm sure there was a good reason for doing this, but changing it to just ctype seems to work for my codebase.

description: updated
description: updated
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.