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 a bug when selecting interpreters with no constraints at all. #6822

merged 3 commits into from Nov 28, 2018


None yet
2 participants
Copy link

benjyw commented Nov 27, 2018

Previously, if there were no interpreter constraints at all, not even default ones (e.g., if the value of interpreter_constraints in [python-setup] was explicitly set to an empty list in pants.ini) we would fail to select an interpreter. This was due to the empty set of interpreters vacuously satisfying the condition of "not leaving any filters unsatisfied" when there are no filters.

This change fixes this, and updates the test that was supposed to exercise this to actually do so. Previously that test set the constraint list to [''], but that is a contrived value, and not the same as having no values at all in the list.

@benjyw benjyw requested a review from jsirois Nov 27, 2018

'Initializing Python interpreter cache matching filters `{}` from paths `{}`'.format(
':'.join(filters), ':'.join(setup_paths)))

def unsatisfied_filters(interpreters):
return [f for f in filters if len(list(self._matching(interpreters, [f]))) == 0]
def unsatisfied_filters(ipreters):

This comment has been minimized.


jsirois Nov 27, 2018


How about extracting a method instead of the tortured name de-shadowing?

This comment has been minimized.


benjyw Nov 27, 2018


That seems like overkill, and would require passing filters in. However, I can remove the argument entirely and have the function look at interpreters directly from its closure.

@benjyw benjyw merged commit 461dd46 into pantsbuild:master Nov 28, 2018

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed

@benjyw benjyw deleted the benjyw:no_constraints_fix branch Nov 28, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment