◐ Shell
clean mode source ↗

gh-104146: Purge dead code from Argument Clinic by erlend-aasland · Pull Request #104680 · python/cpython

@erlend-aasland

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'

AlexWaygood

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

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?

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

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

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

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

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

AlexWaygood