XCB codegen should give a meaningful error message on malformed fieldref
Submitted by Trevour
Assigned to xcb mailing list dummy
Description
Take the following example protocol:
<xcb header="bad" extension-name="bad" extension-xname="BAD">
<request name="BadRequest" code="0">
<list type="CARD8" name="dataVector">
<fieldref>
vectorSize</fieldref>
</list>
</request>
</xcb>
When running it through XCB's codegen, the result is a backtrace and a TypeError that NoneType can't be concatenated with 'str'. As it stands, the error gives no hint that the issue is that vectorSize isn't a previously defined field in the request, which can be easily overlooked(especially if the error is a simple shift failure). Not having any experience in Python, I can't suggest what would be the best fix, but it looks like adding a check in get_type_impl(state.py) for id == NoneType should be sufficient for a simple "Check your fieldrefs" diagnostic.