Repository navigation
Treat marker environment values as literal strings - #985
Open
harbinresearcher wants to merge 1 commit into
Open
harbinresearcher wants to merge 1 commit into
harbinresearcher wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Hey - I've reviewed your changes and they look great!
Sourcery assessment
Needs a human reviewer. If the literal comparison is wrong, Poetry could select or record an incorrect dependency set in a lockfile or environment; reverting would not remove those installed packages or already-written lock data, though they can be repaired by re-resolving and reinstalling.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Environment-marker evaluation can interpret a platform string as constraint syntax. For example:
This raises
ValueErroron main instead of returningTrue: the comma turns the environment value into a compound constraint. Pipes, comparison prefixes, empty strings and*can similarly raise errors or change comparisons; leading/trailing spaces are also stripped.Construct a literal equality
Constraintfor non-version environment values instead of parsing them as expressions. Version-marker parsing and the special handling of extras stay unchanged. This also fixesapply()and atomic marker unions through their existing validation path.Add 34 parameterized cases for positive/negative substring comparisons, equality, atomic unions and partial evaluation. On the original implementation, 26 fail and 8 pass; all 34 pass with this change. The tests enter through the public
parse_marker()API.Validation
poetry check --lockpasses.pre-commit run --all-filespasses; Mypy reports no issues in 152 source files on Windows and Linux.test_path_to_url_winexpects an unescaped cwd and fails when run from our Chinese cwd. No tests, exclusions or product code were changed to address that separate baseline issue. Linux uses a local C compiler wrapper for extension fixtures; the initial six missing-compiler failures are resolved in both original and patched runs.Downstream CI limitation
The downstream run 37893165139 reports 3,309 passed, 34 skipped, 2 expected failures and one failure in
test_extractall_sdist_no_symlink_path_traversal_via_directory_symlink: it expectsOutsideDestinationErroron Python 3.10.22, but no exception is raised.I reproduced this independently using the unchanged downstream
extractall()function at Poetry commit63bba274f8ea6bc9a064f5328fa6c67bce617cc1on Linux Python 3.10.22, with nopoetry.coremodules loaded. The extracted file stays inside the destination and does not escape it. This failure is independent of the marker change; I have not changed extraction code or weakened the downstream test. The core-library matrix has now completed successfully: all 19 platform/Python jobs pass. pre-commit.ci also passes.AI assistance was used for implementation, tests and this description. A second coding agent performed read-only design and diff reviews and found no blockers; it ran no tests. This is a reproducible code-level bug report, without a claim of a production incident or human review.