Skip to content

gh-104146: Purge dead code from Argument Clinic #104680

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

Merged
merged 3 commits into from
May 20, 2023

Conversation

erlend-aasland
Copy link
Contributor

@erlend-aasland erlend-aasland commented May 20, 2023

The following local variables were assigned but never used:

  • line 551: result
  • line 1341: groups
  • line 1431: default_return_converter
  • line 1529: ignore_self
  • line 1809: input_checksum
  • line 4224: new'

The following local variables were assigned but never used:

- line 551:  result
- line 1341: groups
- line 1431: default_return_converter
- line 1529: ignore_self
- line 1809: input_checksum
- line 4224: new'
@@ -4245,8 +4237,7 @@ def directive_version(self, required):
fail("Insufficient Clinic version!\n Version: " + version + "\n Required: " + required)

def directive_module(self, name):
fields = name.split('.')
new = fields.pop()
fields = name.split('.')[1:]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pop() removes the last item in the list, no?

Suggested change
fields = name.split('.')[1:]
fields = name.split('.')[:-1]

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch. Yes, [1:] is definitely wrong. Strangely, make clinic does not complain or generate incorrect.

@AlexWaygood
Copy link
Member

Would you be interested in possibly running pyflakes on Tools/clinic/ in CI, to catch this kind of thing in the future? It's a linter that tries extremely hard to have 0 false positives, and didn't have any hits on Tools/clinic/ other than the ones that are being fixed here

@erlend-aasland
Copy link
Contributor Author

Would you be interested in possibly running pyflakes on Tools/clinic/ in CI, to catch this kind of thing in the future? It's a linter that tries extremely hard to have 0 false positives, and didn't have any hits on Tools/clinic/ other than the ones that are being fixed here

I think that's a good idea. Others might disagree :)

@AlexWaygood
Copy link
Member

I can open an issue and we can see if anybody objects!

@AlexWaygood AlexWaygood enabled auto-merge (squash) May 20, 2023 10:28
@AlexWaygood AlexWaygood merged commit ae147d0 into python:main May 20, 2023
@erlend-aasland erlend-aasland deleted the clinic/the-purge branch May 20, 2023 10:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove dead code from clinic.py
3 participants