Public bug reported:

Consider this header file:

$ cat au.h
struct sus {
        union {
                struct {
                        int first_half :16;
                        int second_half :16;
                };
                int all_of_it;
        };
};

Running h2xml (from python-ctypeslib) on it doesn't work any longer if
an output file is unspecified:

$ h2xml -k au.h
creating xml output file ...
running: gccxml /tmp/tmp38O3UX.cpp
Info: file '/tmp/tmp38O3UX.cpp' not removed
CompilerError:

That's because the gccxml wrapper provided by CastXML doesn't want to
write to stdout:

$ gccxml tmp38O3UX.cpp
GCC-XML compatibility CastXML wrapper
Usage: gccxml [options] <input-file> -fxml=<output-file>

Note: not all the gccxml options are supported.
The real gccxml (not compatible with GCC 5) is available as gccxml.real.


Working around that, the wrapper still produces XML output xml2py (also from 
python-ctypeslib) can't grok:

$ h2xml -k au.h -o au.xml
creating xml output file ...
running: gccxml /tmp/tmpWKQCEt.cpp -fxml=au.xml
Info: file '/tmp/tmpWKQCEt.cpp' not removed

$ xml2py au.xml
Traceback (most recent call last):
  File "/usr/bin/xml2py", line 6, in <module>
    sys.exit(main())
  File "/usr/lib/python2.7/dist-packages/ctypeslib/xml2py.py", line 199, in main
    types=options.kind)
  File "/usr/lib/python2.7/dist-packages/ctypeslib/codegen/codegenerator.py", 
line 834, in generate_code
    items = parse(xmlfile)
  File "/usr/lib/python2.7/dist-packages/ctypeslib/codegen/gccxmlparser.py", 
line 423, in parse
    parser.parse(xmlfile)
  File "/usr/lib/python2.7/dist-packages/ctypeslib/codegen/gccxmlparser.py", 
line 57, in parse
    self.startElement(node.tag, dict(node.items()))
  File "/usr/lib/python2.7/dist-packages/ctypeslib/codegen/gccxmlparser.py", 
line 70, in startElement
    result = mth(attrs)
  File "/usr/lib/python2.7/dist-packages/ctypeslib/codegen/gccxmlparser.py", 
line 307, in Union
    name = MAKE_NAME(attrs["mangled"])
KeyError: 'mangled'

tl;dr: python-ctypeslib has been broken by CastXML, which is the default
upgrade path from gccxml.

** Affects: python-ctypeslib (Ubuntu)
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1657234

Title:
  python-ctypeslib broken by castxml

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/python-ctypeslib/+bug/1657234/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to