[CastXML] Runtime error while finding element_type with containers of pointers

Ankit Deepak adadeepak8 at gmail.com
Sun May 21 06:27:42 EDT 2017


Hello all,

I think I found out where the error was. The problem was not with the
pointer but the space between the type and '*' operator. When working with
pointers, "find_value_type" of "traits_impl_details" removes the '*' using
a substring operation, and when that happened, it tried to find the type of
the actual type along with a space. If this is not an intended behaviour of
the code, then a possible enhancement could be to strip the type string of
the trailing spaces before the find operation.

Thanks,
Ankit Deepak

On Fri, May 19, 2017 at 7:33 PM, Ankit Deepak <adadeepak8 at gmail.com> wrote:

> Hello all,
>
> I have started working on CastXML recently. I am trying to modify
> pybindgen [1] to work with CastXML and latest versions of pygccxml.
> "__find_xxx_type" of "container_traits" throws Runtime Error when it
> encounters std containers having pointers as elements, it works fine with
> other containers. The traceback looks like:
>
> Traceback (most recent call last):
>   File "/home/ankit/Videos/bake/source/ns-3-dev/bindings/
> python/ns3modulescan-modular.py", line 284, in <module>
>     ns3_module_scan(sys.argv[1], sys.argv[2], eval(sys.argv[3]),
> sys.argv[4], sys.argv[5])
>   File "/home/ankit/Videos/bake/source/ns-3-dev/bindings/
> python/ns3modulescan-modular.py", line 265, in ns3_module_scan
>     module_parser.scan_types()
>   File "/home/ankit/Videos/bake/source/pybindgen/pybindgen/castxmlparser.py",
> line 801, in scan_types
>     self._scan_namespace_types(self.module, self.module_namespace,
> pygen_register_function_name="register_types")
>   File "/home/ankit/Videos/bake/source/pybindgen/pybindgen/castxmlparser.py",
> line 1334, in _scan_namespace_types
>     self._register_container(module, traits, type_info, _outer_class,
> name)
>   File "/home/ankit/Videos/bake/source/pybindgen/pybindgen/castxmlparser.py",
> line 1522, in _register_container
>     element_type = traits.element_type(definition)
>   File "build/bdist.linux-x86_64/egg/pygccxml/declarations/container_traits.py",
> line 494, in element_type
>   File "build/bdist.linux-x86_64/egg/pygccxml/declarations/container_traits.py",
> line 484, in __find_xxx_type
> RuntimeError: Unable to find out list '::std::list<ns3::ArpCache::Entry
> *, std::allocator<ns3::ArpCache::Entry *> >' key\value type.
>
> Similarly, it fails with
>
> RuntimeError: Unable to find out map '::std::map<std::basic_string<char>,
> ns3::LogComponent *, std::less<std::basic_string<char> >,
> std::allocator<std::pair<const std::basic_string<char>, ns3::LogComponent
> *> > >' key\value type.
>
> Am I missing something regarding such containers? Please advise.
>
> I am sorry if I was unable to explain everything clearly.
>
> [1] https://github.com/gjcarneiro/pybindgen
>
> Thanks,
> Ankit Deepak
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/castxml/attachments/20170521/de1b0168/attachment.html>


More information about the CastXML mailing list