Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Argument Clinic does not work with custom destination files #94538

Closed
erlend-aasland opened this issue Jul 3, 2022 · 1 comment
Closed

Argument Clinic does not work with custom destination files #94538

erlend-aasland opened this issue Jul 3, 2022 · 1 comment
Labels
topic-argument-clinic type-bug An unexpected behavior, bug, or error

Comments

@erlend-aasland
Copy link
Contributor

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.

@erlend-aasland erlend-aasland added type-bug An unexpected behavior, bug, or error topic-argument-clinic labels Jul 3, 2022
erlend-aasland added a commit to erlend-aasland/cpython that referenced this issue Jul 3, 2022
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Jul 5, 2022
…4539)

(cherry picked from commit 2b8ed4d)

Co-authored-by: Erlend Egeberg Aasland <erlend.aasland@protonmail.com>
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Jul 5, 2022
…4539)

(cherry picked from commit 2b8ed4d)

Co-authored-by: Erlend Egeberg Aasland <erlend.aasland@protonmail.com>
ambv pushed a commit that referenced this issue Jul 5, 2022
)

(cherry picked from commit 2b8ed4d)

Co-authored-by: Erlend Egeberg Aasland <erlend.aasland@protonmail.com>
ambv pushed a commit that referenced this issue Jul 5, 2022
)

(cherry picked from commit 2b8ed4d)

Co-authored-by: Erlend Egeberg Aasland <erlend.aasland@protonmail.com>
@ambv
Copy link
Contributor

ambv commented Jul 5, 2022

This is now fixed in 3.10 - 3.12. Thanks, Erlend! ✨ 🍰 ✨

@ambv ambv closed this as completed Jul 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic-argument-clinic type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

2 participants