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

Removing unused and unnecessary code #5309

Merged
merged 5 commits into from
Mar 18, 2022

Conversation

dimbleby
Copy link
Contributor

Pull Request Check List

A follow-up to my remark in #5305 that seen looked redundant on the node in the solver's depth first search, because the surrounding search already had a visited.

The doubt in my mind was that there was a second caller of reachable(), here, and I hadn't taken the time to figure out the effect on that call site.

On reflection it is clear that the seen cache will be populated by the time we get to that second caller - which happens after the depth-first search has completed. As a result, that second reachable() never returns anything other than an empty list.

(I also confirmed this by asserting as much in the code, and verifying that the test suite still passed)

Since nothing seems to be broken by that list being empty, I've assumed that we don't need that second reachable() call after all; and then it is clear that seen is indeed redundant. So I've made two commits:

  • remove the code which was made useless by seen
  • remove seen

(I probably have given myself a small merge conflict with #5305, happy to sort that out if and when the first of these is merged).

@dimbleby
Copy link
Contributor Author

(I have rearranged this and #5305 so that this one contains the refactoring and the other contains only the fix)

@dimbleby dimbleby mentioned this pull request Mar 13, 2022
2 tasks
Copy link
Member

@radoering radoering left a comment

Choose a reason for hiding this comment

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

Good catch and well prepared. At some points, I had to think twice about it, but in the end I am quite sure you are absolutely right. 👍

@radoering radoering merged commit ad2bfe7 into python-poetry:master Mar 18, 2022
@dimbleby dimbleby deleted the reachable-nonsense branch March 18, 2022 17:24
@kasteph kasteph mentioned this pull request May 30, 2022
Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 29, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants