CastXML / pygccxml

pygccxml is a specialized XML reader that reads the output from CastXML or GCCXML. It provides a simple framework to navigate C++ declarations, using Python classes.
Boost Software License 1.0
131 stars 45 forks source link

is_noncopyable _decl.is_abstract check fails #90

Closed dermont123 closed 6 years ago

dermont123 commented 7 years ago

Here is an example code from pyplusplus. item_type = declarations.array_item_type(self.declaration.decl_type) is_noncopyable = not declarations.is_fundamental(item_type) and \ declarations.is_noncopyable(item_type)

In type_traits_class.py is_noncopyable() the "is_abstract check" fails with an Attribute error when an array item is an unknown_t, enum_t or cpptypes.free_function_type_t.

The pypplusplus code needs updating but even in Debug mode it is impossible to track down the origin. Would it be possible to wrap the "is_abstract " in a try/except with appropriate debug info when it fails. It would be even better if pygccxml could handle this but if you think otherwise I can try raising it on the pyplusplus repo.

Thanks.

iMichka commented 7 years ago

Hi. Thanks for reporting this. I am quite busy at the moment, and will have no time to look at this in detail.

What would be great is that you provide a minimal c++ code snippet that could serve as test.

Adding a try/except to the whole function is probably not the best thing to do. That kind of thing is best used to wrap the place where the function is called. Maybe we could implement a context manager for all the is_* functions, to improve logging, but that is not planned for the moment.

I think the best bet would be to fix the bug itself. If you provide me a simple example of c++ code that fails we can try to track this down.

dermont123 commented 6 years ago

Hi,

Sorry for the delay in replying. The problem appears to be with pyplusplus and the array code generation in array_1_registrator.py and member_variable.py.

There doesn't appear to be a bug tracker for pyplusplus so I don't know where to raise this. This is an example for pyplusplus in case one of their developers look in.

ARRAYPROBLEM.zip

Sorry for wasting your time, you can probably close this.

iMichka commented 6 years ago

The latest version of pyplusplus can be found here: https://bitbucket.org/ompl/pyplusplus You may ask them for help.

I'll close this bug for the time being. Of course if you provide a minimal c++ example that demonstrates a bug in pygccxml, I can have a look and try to fix it.