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 'destination <name> clear' is broken #106970

Closed
erlend-aasland opened this issue Jul 21, 2023 · 2 comments
Closed

Argument Clinic 'destination <name> clear' is broken #106970

erlend-aasland opened this issue Jul 21, 2023 · 2 comments
Assignees
Labels
topic-argument-clinic type-bug An unexpected behavior, bug, or error

Comments

@erlend-aasland
Copy link
Contributor

erlend-aasland commented Jul 21, 2023

The destination <name> clear command is documented like this:

It removes all the accumulated text up to this point in the destination. (I don’t know what you’d need this for, but I thought maybe it’d be useful while someone’s experimenting.)

Clearly, the last sentence is correct, because this command contains two bugs, and nobody has ever complained:

  1. It accesses the wrong attribute when clearing the accumulators
  2. The directive parser does not return immediately after executing the clear command, so it jumps straight into "fail because we got an unknown command"

The fixes are easy, so I suggest we apply the fixes and add regressions tests. An alternative could be to remove the clear command, but I don't think we should tear out features lightly, no matter how obscure they are.

Found while working on #106935.

Linked PRs

@erlend-aasland erlend-aasland added type-bug An unexpected behavior, bug, or error topic-argument-clinic labels Jul 21, 2023
@erlend-aasland erlend-aasland self-assigned this Jul 21, 2023
erlend-aasland added a commit that referenced this issue Jul 22, 2023
…06972)

Add test for the 'destination <name> clear' command,
and the 'destination' directive in general.

Fix two bugs in 'destination <name> clear' command:

1. The text attribute of the allocator is called 'text', not '_text'
2. Return after processing the 'clear' command,
   instead of proceeding directly to the fail().
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Jul 22, 2023
…nd (pythonGH-106972)

Add test for the 'destination <name> clear' command,
and the 'destination' directive in general.

Fix two bugs in 'destination <name> clear' command:

1. The text attribute of the allocator is called 'text', not '_text'
2. Return after processing the 'clear' command,
   instead of proceeding directly to the fail().
(cherry picked from commit 3372bcb)

Co-authored-by: Erlend E. Aasland <erlend@python.org>
erlend-aasland added a commit that referenced this issue Jul 22, 2023
…and (GH-106972) (#106983)

Add test for the 'destination <name> clear' command,
and the 'destination' directive in general.

Fix two bugs in 'destination <name> clear' command:

1. The text attribute of the allocator is called 'text', not '_text'
2. Return after processing the 'clear' command,
   instead of proceeding directly to the fail().
(cherry picked from commit 3372bcb)

Co-authored-by: Erlend E. Aasland <erlend@python.org>
erlend-aasland added a commit that referenced this issue Jul 22, 2023
…and (#106972) (#107059)

Add test for the 'destination <name> clear' command,
and the 'destination' directive in general.

Fix two bugs in 'destination <name> clear' command:

1. The text attribute of the allocator is called 'text', not '_text'
2. Return after processing the 'clear' command,
   instead of proceeding directly to the fail().

(cherry picked from commit 3372bcb)
@AlexWaygood
Copy link
Member

Is this fixed now?

@erlend-aasland
Copy link
Contributor Author

Yep!

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