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
129 stars 44 forks source link

Test 'test_overrides.py' fails with CastXML-0.6.1 #164

Open dl1jbe opened 11 months ago

dl1jbe commented 11 months ago

With CastXML-0.6.1 installed "test_overrides.py" fails for >=pygccxml-2.2.1 with the following trace-back.

ERROR: test (unittests.test_overrides.Test.test)
Check that the override information is populated for the

Traceback (most recent call last):
  File "/var/tmp/portage/dev-python/pygccxml-2.3.0/work/pygccxml-2.3.0/unittests/test_overrides.py", line 26, in setUp
    decls = parser.parse([self.header], self.config)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/var/tmp/portage/dev-python/pygccxml-2.3.0/work/pygccxml-2.3.0/pygccxml/parser/__init__.py", line 51, in parse
    declarations = parser.read_files(files, compilation_mode)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/var/tmp/portage/dev-python/pygccxml-2.3.0/work/pygccxml-2.3.0/pygccxml/parser/project_reader.py", line 264, in read_files
    return self.__parse_file_by_file(files)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/var/tmp/portage/dev-python/pygccxml-2.3.0/work/pygccxml-2.3.0/pygccxml/parser/project_reader.py", line 292, in __parse_file_by_file
    decls = reader.read_file(header)
            ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/var/tmp/portage/dev-python/pygccxml-2.3.0/work/pygccxml-2.3.0/pygccxml/parser/source_reader.py", line 303, in read_file
    return self.read_cpp_source_file(source_file)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/var/tmp/portage/dev-python/pygccxml-2.3.0/work/pygccxml-2.3.0/pygccxml/parser/source_reader.py", line 323, in read_cpp_source_file
    decls, files = self.__parse_xml_file(xml_file)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/var/tmp/portage/dev-python/pygccxml-2.3.0/work/pygccxml-2.3.0/pygccxml/parser/source_reader.py", line 421, in __parse_xml_file
    patcher.fix_calldef_decls(
  File "/var/tmp/portage/dev-python/pygccxml-2.3.0/work/pygccxml-2.3.0/pygccxml/parser/patcher.py", line 261, in fix_calldef_decls
    default_arg_patcher(decl)
  File "/var/tmp/portage/dev-python/pygccxml-2.3.0/work/pygccxml-2.3.0/pygccxml/parser/patcher.py", line 23, in __call__
    fixer = self.__find_fixer(decl, arg)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/var/tmp/portage/dev-python/pygccxml-2.3.0/work/pygccxml-2.3.0/pygccxml/parser/patcher.py", line 32, in __find_fixer
    elif self.__is_invalid_integral(func, arg):
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/var/tmp/portage/dev-python/pygccxml-2.3.0/work/pygccxml-2.3.0/pygccxml/parser/patcher.py", line 75, in __is_invalid_integral
    if not declarations.is_integral(type_):
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/var/tmp/portage/dev-python/pygccxml-2.3.0/work/pygccxml-2.3.0/pygccxml/declarations/type_traits.py", line 213, in is_integral
    return remove_alias(type_) in _integral_def
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/var/tmp/portage/dev-python/pygccxml-2.3.0/work/pygccxml-2.3.0/pygccxml/declarations/cpptypes.py", line 31, in __eq__
    return self.decl_string == other.decl_string
                               ^^^^^^^^^^^^^^^^^
  File "/var/tmp/portage/dev-python/pygccxml-2.3.0/work/pygccxml-2.3.0/pygccxml/declarations/cpptypes.py", line 50, in decl_string
    self.cache.decl_string = self.build_decl_string()
                             ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/var/tmp/portage/dev-python/pygccxml-2.3.0/work/pygccxml-2.3.0/pygccxml/declarations/cpptypes.py", line 596, in build_decl_string
    if hasattr(self.base.declaration, "elaborated_type_specifier"):
               ^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'int_t' object has no attribute 'declaration'

Works without problems for CastXML-0.5.1. Not sure on which side (CastXML or PyGCCXML) the problem is.