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

Fix an infinite loop in the solver #6178

Merged

Conversation

dimbleby
Copy link
Contributor

@dimbleby dimbleby commented Aug 16, 2022

I tried bumping crashtest to 0.4.0 in poetry itself. This can't work because cleo requires a lower version than that, but instead of failure I hit an infinite loop.

Turned out there are two separate bugs here, both with the effect that version 1.0.0a5 of cleo is retried even after it has been ruled out because of this incompatibility

  • first, we go into _get_locked() with a constraint that should explicitly rule out 1.0.0a5 - >1.0.0a5,<2.0.0 - but because of the prerelease we decide that 1.0.0a5 is fine after all. So far as I can see the code that I've removed just doesn't want to be there: anyway removing it doesn't break any existing tests and helps this one...

  • then we go into search_for_installed_packages() again having started with a constraint that should rule out 1.0.0a5: but in here we pay no attention to that constraint at all. So we again rediscover the already ruled-out version. I've fixed this one by respecting the dependency in that function.

@dimbleby dimbleby force-pushed the infinite-loop-bumping-crashtest branch 2 times, most recently from 12108ce to 99e763e Compare August 16, 2022 20:57
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.

LGTM 👍

if (allow_similar or dependency.is_same_package_as(package)) and (
dependency.constraint.allows(package.version)
or package.is_prerelease()
and dependency.constraint.allows(package.version.next_patch())
Copy link
Member

Choose a reason for hiding this comment

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

I stumbled over such a construct in #6165 (and removed it, too). I assume this was a workaround to deal with a previous shortcoming somewhere else that has been fixed in the meantime.

@radoering radoering merged commit d1dbdef into python-poetry:master Aug 17, 2022
@dimbleby dimbleby deleted the infinite-loop-bumping-crashtest branch August 17, 2022 07:53
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