#37 KeyError in _join_class_hierarchy.

open
Roman
None
5
2011-12-21
2011-12-21
Josh Davidson
No

Background: http://mail.python.org/pipermail/cplusplus-sig/2011-December/016292.html

c:\Users\davidsj2\Desktop\gccxml_join>python gen.py
INFO Parsing source file "SharedMemoryDeleter.hpp" ...
INFO gccxml cmd: ""C:\mingw64-i686-20110207\bin\gccxml.exe" -DBOOST_NO_RVALUE_REFERENCES -D__mode__(x)= -DMS_WIN64 -I"." -I"c:\Python26\include" "SharedMemoryDeleter.hpp" -fxml="c:\users\davidsj2\appdata\local\temp\tmpuiveje.xml""
INFO GCCXML version - 0.9( 1.135 )
INFO Parsing source file "SharedMemoryBuilder.hpp" ...
INFO gccxml cmd: ""C:\mingw64-i686-20110207\bin\gccxml.exe" -DBOOST_NO_RVALUE_REFERENCES -D__mode__(x)= -DMS_WIN64 -I"." -I"c:\Python26\include" "SharedMemoryBuilder.hpp" -fxml="c:\users\davidsj2\appdata\local\temp\tmpxcuc7q.xml""
INFO GCCXML version - 0.9( 1.135 )
INFO Parsing source file "DiscreteStore.hpp" ...
INFO gccxml cmd: ""C:\mingw64-i686-20110207\bin\gccxml.exe" -DBOOST_NO_RVALUE_REFERENCES -D__mode__(x)= -DMS_WIN64 -I"." -I"c:\Python26\include" "DiscreteStore.hpp" -fxml="c:\users\davidsj2\appdata\local\temp\tmpgrbkoj.xml""
INFO GCCXML version - 0.9( 1.135 )
INFO Parsing source file "SpaceWireStore.hpp" ...
INFO gccxml cmd: ""C:\mingw64-i686-20110207\bin\gccxml.exe" -DBOOST_NO_RVALUE_REFERENCES -D__mode__(x)= -DMS_WIN64 -I"." -I"c:\Python26\include" "SpaceWireStore.hpp" -fxml="c:\users\davidsj2\appdata\local\temp\tmpk0tv4u.xml""
INFO GCCXML version - 0.9( 1.135 )
Traceback (most recent call last):
File "gen.py", line 19, in <module>
include_paths=incDirs, cflags=cflags)
File "c:\Python26\lib\site-packages\pyplusplus\module_builder\boost_python_builder.py", line 95, in __init__
, indexing_suite_version)
File "c:\Python26\lib\site-packages\pyplusplus\module_builder\boost_python_builder.py", line 138, in __parse_declarations
decls = reader.read_files( files, compilation_mode )
File "c:\Python26\lib\site-packages\pygccxml\parser\project_reader.py", line 217, in read_files
return self.__parse_file_by_file(files)
File "c:\Python26\lib\site-packages\pygccxml\parser\project_reader.py", line 272, in __parse_file_by_file
leaved_classes = self._join_class_hierarchy( answer )
File "c:\Python26\lib\site-packages\pygccxml\parser\project_reader.py", line 445, in _join_class_hierarchy
leaved_derived = leaved_classes[ create_key( derived_info.related_class ) ]
KeyError: (('c:/mingw64-i686-20110207/lib/gcc/../../x86_64-w64-mingw32/include/boost/intrusive/options.hpp', 209), ('::', 'boost', 'intrusive', 'constant_time_size<true>', 'pack<boost::intrusive::base_hook<boost::intrusive::detail::default_set_hook>::pack<boost::intrusive::none>
>'))

Discussion

  • Josh Davidson
    Josh Davidson
    2011-12-21

    Self contained example

     
    Attachments
  • Josh Davidson
    Josh Davidson
    2011-12-21

    • assigned_to: nobody --> roman_yakovenko
    • summary: _join_class_hierarchy. --> KeyError in _join_class_hierarchy.
     
  • Chris
    Chris
    2012-09-10

    I was able to fix this bug (as of version 1.5.1) by adding one line of code in the pygccxml/parser/source_reader.py file. In the __produce_full_file function (starting on line 286), add the following line in between the if os.name check, and the if.os.path.isabs check

    file_path = os.path.abspath (file_path)

    This worked out to be line 289 in my instance. Strangely, the if os.path.abspath will evaluate to true, even if there are ./ or ../ present in the provided file path string. This extra line of code forcing an absolute path resolution solves the problem, at least in the scope of my project. Hopefully this can be tested on a broader scale and verified as a proper fix.

    I suppose in the spirit of completeness, one could entirely remove the if os.path.abspath check, and move my suggested line into the try block in place of the os.path.realpath code.