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

Remove dead code from clinic.py #104146

Closed
erlend-aasland opened this issue May 3, 2023 · 4 comments · Fixed by #104147, #104214, #104627, #104680 or #106358
Closed

Remove dead code from clinic.py #104146

erlend-aasland opened this issue May 3, 2023 · 4 comments · Fixed by #104147, #104214, #104627, #104680 or #106358
Assignees

Comments

@erlend-aasland erlend-aasland self-assigned this May 3, 2023
erlend-aasland added a commit to erlend-aasland/cpython that referenced this issue May 3, 2023
The code that manipulated 'second_pass_replacements' was removed in 2015
with commit 0759f84 (pythongh-67688, bpo-23500).
erlend-aasland added a commit to erlend-aasland/cpython that referenced this issue May 3, 2023
The code that manipulated 'second_pass_replacements' was removed in 2015
with commit 0759f84 (pythongh-67688, bpo-23500).
erlend-aasland added a commit that referenced this issue May 4, 2023
…104147)

The code that manipulated 'second_pass_replacements' was removed in 2015
with commit 0759f84 (gh-67688, bpo-23500).
@erlend-aasland erlend-aasland reopened this May 5, 2023
erlend-aasland added a commit to erlend-aasland/cpython that referenced this issue May 5, 2023
carljm added a commit to carljm/cpython that referenced this issue May 5, 2023
* main:
  pythongh-99113: Add PyInterpreterConfig.own_gil (pythongh-104204)
  pythongh-104146: Remove unused var 'parser_body_declarations' from clinic.py (python#104214)
  pythongh-99113: Add Py_MOD_PER_INTERPRETER_GIL_SUPPORTED (pythongh-104205)
  pythongh-104108: Add the Py_mod_multiple_interpreters Module Def Slot (pythongh-104148)
  pythongh-99113: Share the GIL via PyInterpreterState.ceval.gil (pythongh-104203)
  pythonGH-100479: Add `pathlib.PurePath.with_segments()` (pythonGH-103975)
  pythongh-69152: Add _proxy_response_headers attribute to HTTPConnection (python#26152)
  pythongh-103533: Use PEP 669 APIs for cprofile (pythonGH-103534)
  pythonGH-96803: Add three C-API functions to make _PyInterpreterFrame less opaque for users of PEP 523. (pythonGH-96849)
jbower-fb pushed a commit to jbower-fb/cpython-jbowerfb that referenced this issue May 8, 2023
@erlend-aasland
Copy link
Contributor Author

Encountered more unused vars in DSLParser.directive_class; reopening.

erlend-aasland added a commit to erlend-aasland/cpython that referenced this issue May 18, 2023
Remove 'in_classes' and 'so_far' from DSLParser.directive_module()
@erlend-aasland erlend-aasland linked a pull request May 18, 2023 that will close this issue
erlend-aasland added a commit that referenced this issue May 18, 2023
Remove 'in_classes' and 'so_far' from DSLParser.directive_module()
@AlexWaygood
Copy link
Member

Running pyflakes on Tools/clinic finds a few more yet:

Tools/clinic/clinic.py:551:5: local variable 'result' is assigned to but never used
Tools/clinic/clinic.py:1341:9: local variable 'groups' is assigned to but never used
Tools/clinic/clinic.py:1431:9: local variable 'default_return_converter' is assigned to but never used
Tools/clinic/clinic.py:1529:9: local variable 'ignore_self' is assigned to but never used
Tools/clinic/clinic.py:1809:21: local variable 'input_checksum' is assigned to but never used
Tools/clinic/clinic.py:4224:9: local variable 'new' is assigned to but never used

All except maybe the last one look as though they're true positives to me, from skimming the code.

carljm added a commit to carljm/cpython that referenced this issue May 18, 2023
* main:
  pythongh-74690: Don't set special protocol attributes on non-protocol subclasses of protocols (python#104622)
  pythongh-104623: Update Windows installer to use SQLite 3.42.0 (python#104625)
  pythongh-104050: Add more type annotations to Argument Clinic (python#104628)
  pythongh-104629: Don't skip test_clinic if _testclinic is missing (python#104630)
  pythongh-104549: Set __module__ on TypeAliasType (python#104550)
  pythongh-104050: Improve some typing around `default`s and sentinel values (python#104626)
  pythongh-104146: Remove unused vars from Argument Clinic (python#104627)
  pythongh-104615: don't make unsafe swaps in apply_static_swaps (python#104620)
  pythonGH-104484: Add case_sensitive argument to `pathlib.PurePath.match()` (pythonGH-104565)
  pythonGH-96803: Document and test new unstable internal frame API functions (pythonGH-104211)
  pythonGH-104580: Don't cache eval breaker in interpreter (pythonGH-104581)
@erlend-aasland
Copy link
Contributor Author

Running pyflakes on Tools/clinic finds a few more yet:

Let's leave this open, but I suggest we remove them when we encounter issues with them. For example, in gh-104627 I removed variables that created havoc when I added type annotations for the surrounding code.

@erlend-aasland
Copy link
Contributor Author

OTOH, there's no harm in removing them right away. After all, the grand plan is to improve the readability and maintainability of Argument Clinic. Unused code is clutter, and it makes it harder to understand what's happening.

erlend-aasland added a commit to erlend-aasland/cpython that referenced this issue 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'
@erlend-aasland erlend-aasland linked a pull request May 20, 2023 that will close this issue
AlexWaygood added a commit that referenced this issue 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'

---

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
@erlend-aasland erlend-aasland reopened this Jul 3, 2023
erlend-aasland added a commit to erlend-aasland/cpython that referenced this issue Jul 3, 2023
carljm added a commit to carljm/cpython that referenced this issue Jul 3, 2023
* main: (167 commits)
  pythongh-91053: make func watcher tests resilient to other func watchers (python#106286)
  pythongh-104050: Add more type hints to Argument Clinic DSLParser() (python#106354)
  pythongh-106359: Fix corner case bugs in Argument Clinic converter parser (python#106361)
  pythongh-104146: Remove unused attr 'parameter_indent' from clinic.DLParser (python#106358)
  pythongh-106320: Remove private _PyErr C API functions (python#106356)
  pythongh-104050: Annotate Argument Clinic DSLParser attributes (python#106357)
  pythongh-106320: Create pycore_modsupport.h header file (python#106355)
  pythongh-106320: Move _PyUnicodeWriter to the internal C API (python#106342)
  pythongh-61215: New mock to wait for multi-threaded events to happen (python#16094)
  Document PYTHONSAFEPATH along side -P (python#106122)
  Replace the esoteric term 'datum' when describing dict comprehensions (python#106119)
  pythongh-104050: Add more type hints to Argument Clinic DSLParser() (python#106343)
  pythongh-106320: _testcapi avoids private _PyUnicode_EqualToASCIIString() (python#106341)
  pythongh-106320: Add pycore_complexobject.h header file (python#106339)
  pythongh-106078: Move DecimalException to _decimal state (python#106301)
  pythongh-106320: Use _PyInterpreterState_GET() (python#106336)
  pythongh-106320: Remove private _PyInterpreterState functions (python#106335)
  pythongh-104922: Doc: add note about PY_SSIZE_T_CLEAN (python#106314)
  pythongh-106217: Truncate the issue body size of `new-bugs-announce-notifier` (python#106329)
  pythongh-104922: remove PY_SSIZE_T_CLEAN (python#106315)
  ...
@erlend-aasland erlend-aasland reopened this Aug 2, 2023
erlend-aasland added a commit to erlend-aasland/cpython that referenced this issue Aug 2, 2023
Remove commented out lines from clinic.py
@erlend-aasland erlend-aasland linked a pull request Aug 2, 2023 that will close this issue
AlexWaygood added a commit to AlexWaygood/cpython that referenced this issue Aug 4, 2023
AlexWaygood added a commit to AlexWaygood/cpython that referenced this issue Aug 4, 2023
@erlend-aasland erlend-aasland reopened this Aug 4, 2023
erlend-aasland added a commit to erlend-aasland/cpython that referenced this issue May 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment