Skip to content

Argument Clinic does not work with custom destination files #94538

Closed
@erlend-aasland

Description

@erlend-aasland

Bug report

Argument Clinic does not work with custom destination files, for example given this clinic input:

destination test new file test.c.h
output push
output methoddef_define test
output parser_prototype test
output docstring_prototype test
Traceback
$ python3.11 Tools/clinic/clinic.py -f test.c
Error in file "test.c" on line 224:
Exception raised during parsing:
Traceback (most recent call last):
  File "Tools/clinic/clinic.py", line 2030, in parse
    parser.parse(block)
    ^^^^^^^^^^^^^^^^^^^
  File "Tools/clinic/clinic.py", line 4176, in parse
    block.output.extend(self.clinic.language.render(clinic, block.signatures))
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "Tools/clinic/clinic.py", line 614, in render
    return self.render_function(clinic, function)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "Tools/clinic/clinic.py", line 1453, in render_function
    destination.append(s)
    ^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'Destination' object has no attribute 'append'

This occurs because AC tries to append to a buffer (clinic.destination_buffers), but it receives a Destination object instead. The failure is in the output directive parser; it incorrectly updates clinic.destination_buffers with the destination object, instead of using the result of clinic.get_destination_buffer.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions