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

Prevent empty parentheses from appearing in lockfile marker #1801

Closed
wants to merge 1 commit into from
Closed

Prevent empty parentheses from appearing in lockfile marker #1801

wants to merge 1 commit into from

Conversation

oliver-charlesworth
Copy link

@oliver-charlesworth oliver-charlesworth commented Dec 28, 2019

Fixes #1728.
Fixes #1772.

Prior to this PR, an extra dependency of the form:

foo (>=x.y.z); (some_constraint) and extra == 'bar'

would be serialised to the lockfile as:

marker = "some_constraint and ()"

Per #1728, the lockfile parser crashes on this.

This PR fixes that.

So far as I can tell this needs to be fixed on the serialisation side - empty parentheses are not permitted by the PEP 508 grammar.

The fix is implemented by updating MultiMarker.__str__ to filter out any/empty markers (which occur when with_extras=False), similarly to the existing behaviour of MarkerUnion.__str__.

I'd like to add more defensive test coverage for the various MarkerXyz classes, but I'll do that in a follow-up PR.

@finswimmer finswimmer requested a review from a team December 29, 2019 13:55
@finswimmer finswimmer added the kind/bug Something isn't working as expected label Dec 29, 2019
@finswimmer
Copy link
Member

Hey @oliver-charlesworth,

thanks a lot for your contribution 👍

It looks like this is superseded by #2361 in the meantime.

Feel free to leave a comment if you disagree.

fin swimmer

@finswimmer finswimmer closed this Sep 6, 2020
Copy link

github-actions bot commented Mar 1, 2024

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 Mar 1, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/bug Something isn't working as expected
Projects
None yet
2 participants